ComponentPro UltimateFtp

      Auto-rename existing target files

      Language Filter: AllSend comments on this topic to ComponentPro

      When transferring multiple files using the Upload or Download method, specify the FileOverwriteMode.Rename argument to rename existing files automatically. The default renaming pattern (set in the RenamingPattern property) is "{name}[{num}]{ext}", meaning a number is added in between the filename and extension.

      // 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);
      
          TransferOptions opt = new TransferOptions();
          opt.FileOverwriteMode = FileOverwriteMode.Rename;
          client.Upload(@"D:\data", "/data", opt);
      }
      
      You can also specify a different name by handling the TransferConfirm event.