public override string Execute(string renameTo, ClientConnection connection) { if (string.IsNullOrWhiteSpace(connection.renameFrom) || string.IsNullOrWhiteSpace(renameTo)) { return("450 Requested file action not taken"); } connection.renameFrom = connection.NormalizeFilename(connection.renameFrom); renameTo = connection.NormalizeFilename(renameTo); if (connection.renameFrom != null && renameTo != null) { if (File.Exists(connection.renameFrom)) { File.Move(connection.renameFrom, renameTo); } else if (Directory.Exists(connection.renameFrom)) { Directory.Move(connection.renameFrom, renameTo); } else { return("450 Requested file action not taken"); } return("250 Requested file action okay, completed"); } return("450 Requested file action not taken"); }
public override string Execute(string pathname, ClientConnection connection) { pathname = connection.NormalizeFilename(pathname); if (pathname != null) { var state = new ClientConnection.DataConnectionOperation { Arguments = pathname, Operation = connection.ListOperation }; connection.SetupDataConnectionOperation(state); return(string.Format("150 Opening {0} mode data transfer for LIST", connection.dataConnectionType)); } return("450 Requested file action not taken"); }
public override string Execute(string pathname, ClientConnection connection) { pathname = connection.NormalizeFilename(pathname); if (pathname != null) { if (File.Exists(pathname)) { var state = new ClientConnection.DataConnectionOperation { Arguments = pathname, Operation = connection.RetrieveOperation }; connection.SetupDataConnectionOperation(state); return(string.Format("150 Opening {0} mode data transfer for RETR", connection.dataConnectionType)); } } return("550 File Not Found"); }
public override string Execute(string pathname, ClientConnection connection) { pathname = connection.NormalizeFilename(pathname); if (pathname != null) { if (File.Exists(pathname)) { File.Delete(pathname); } else { return("550 File Not Found"); } return("250 Requested file action okay, completed"); } return("550 File Not Found"); }
public override string Execute(string pathname, ClientConnection connection) { pathname = connection.NormalizeFilename(pathname); if (pathname != null) { if (!Directory.Exists(pathname)) { Directory.CreateDirectory(pathname); } else { return("550 Directory already exists"); } return("250 Requested file action okay, completed"); } return("550 Directory Not Found"); }