ComponentPro UltimateFtp

      Download files to another file system

      Language Filter: AllSend comments on this topic to ComponentPro

      To download files and directories on an SFTP server to another file system such as the ZIP file system, use the Download method overloads that have the destinationFileSystem parameter like this Download method.

      The following example code shows you how to connect to an SFTP server and download files to a ZIP file on-the-fly.

      using ComponentPro.IO;
      using ComponentPro.Net;
      using ComponentPro.Compression;
      // Connect to an SFTP file system.
      Sftp sftp = new Sftp();
      sftp.Connect("", 22);
      sftp.Authenticate("test", "test");
      // Create a new zip file.
      Zip zip = new Zip();
      // Add all remote files to the newly created archive. 
      // This operation directly adds files to the ZIP file, no temporary files created. 
      // Use this
      zip.AddFiles(sftp, "", false, null, "", new TransferOptions()); 
      // or this 
      // sftp.DownloadFiles("", false, null, zip, "", new TransferOptions()); 
      // Close all used resources.