ComponentPro UltimateSftp

      Unified API for SFTP and FTP

      Language Filter: AllSend comments on this topic to ComponentPro

      The same code for both FTP and SFTP

      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 Ftp, Sftp, 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 Sftp and Ftp classes implement, defines most Ftp and Sftp 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();
      
      The Ftp class is not included in the Ultimate SFTP component. To use it, please obtain the Ultimate FTP component, Ultimate FTP Expert suite, Ultimate Network Expert suite, or Ultimate Studio suite.