ComponentPro UltimateFtp

      Download a remote directory to another file system

      Language Filter: AllSend comments on this topic to ComponentPro

      You can also download an entire directory to another file system using this Download method. For example, download remote directory "/data" to a ZIP file without using any temporary files:

      using (Sftp client = new Sftp())
      {
          // Connect to the SFTP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Open an existing zip file. 
          Zip zip = new Zip();
      
          zip.Open("test.zip");
      
          // Download "data" remote directory to the ZIP archive. 
          // The archive will contain "/data" folder 
          client.Download("/data", true, null, zip, "/", new TransferOptions());
      
          zip.Close();
      }