ComponentPro UltimateFtp

      Download a remote directory

      Language Filter: AllSend comments on this topic to ComponentPro

      To download an entire remote directory, pass the path to the directory ending with '/' to the Download method.

      using (Ftp client = new Ftp())
      {
          // Connect to the FTP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Download "data" directory from the server. 
          // The local dir "c:\temp" will contain "data" folder 
          client.Download("/data/", @"c:\temp");
      }
      

      Alternatively, you can use this Download overload method with the includeBaseDirectory parameter set to true. The following code snippet shows how to upload an entire directory.

      using (Ftp client = new Ftp())
      {
          // Connect to the FTP server. 
          client.Connect("localhost");
      
          // Authenticate. 
          client.Authenticate("test", "test");
      
          // Download "data" directory from the server. 
          // The local dir "c:\temp" will contain "data" folder 
          client.Download("/data", true, null, @"c:\temp", new TransferOptions());
      }