FTP and SFTP are two different file transfer protocols, but they both cover same task - transferring files over the network. Our Unified File System library lets you write the same code for file management with FTP, SFTP, and ZIP. One of the benefits of having similar API across Sftp, Ftp, and Zip classes is that the time required to familiarize yourself with a new protocol is minimized or eliminated altogether. The interface IRemoteFileSystem that both Ftp and Sftp classes implement, defines most Sftp and Ftp methods, properties, and events, making it easy to write the single code segment to work with both protocols as shown in the example below:
// The IRemoteFileSystem interface is used for all remote file systems, including Ftp, Sftp, and Scp. IRemoteFileSystem client; // Create a new class instance. if (isFtp) client = new Ftp(); else client = new Sftp(); // Connect to the server client.Connect(serverName, serverPort); // Authenticate the user. client.Authenticate(userName, password); // Upload files in "C:\data" to "/data". client.Upload(@"C:\data", "/data"); // Download a remote file. client.DownloadFile("/content/file.txt", @"c:\data\file.txt"); // Close the connection. client.Disconnect();