ComponentPro UltimateFtp

      Resume interrupted transfers

      Language Filter: AllSend comments on this topic to ComponentPro

      When a transfer is interrupted due to a disconnected connection or user abortion, files that are still in transfer progress may be incomplete. Instead of transferring them all again, you can resume transferring the missing parts of the incomplete files only. By specifying FileOverwriteMode.ResumeFileTransfer as the action on existing files, the Upload and Download methods can do this automatically. The library will do the following:

      • Transfer files that are not present in the destination directory.
      • Resume transfer incomplete destination files which have a smaller size than on the source ones.
      • Ignore/skip all files that similar name and size.
      // Create a new instance of the Ftp class. 
      using (Ftp client = new Ftp())
      {
          // Connect to the server. 
          client.Connect(serverName);
      
          // Authenticate the user 
          client.Authenticate(userName, password);
      
          // Resume upload files. 
          client.Upload(@"c:\data", "/data", true, FileOverwriteMode.ResumeFileTransfer);
      
          // Resume download "*.dat" and "*.txt" files. 
          client.Download("/data/*.dat;*.txt", @"c:\data", true, FileOverwriteMode.ResumeFileTransfer);
      }