Rebex

Skip to content, Skip to navigation




Sample: FTP Batch Transfer

Recursively transfers a whole directory tree to or from an FTP server.

BatchTransfer Screenshot

A simple GUI client that connects to the specified FTP server and download or upload a directory including all files and subdirectories (both VB.NET and C#). Displays a progress bar and other batch transfer state information. Error-handling form to make it possible to select a desired reaction to any problem detected during the batch transfer (such as a file that already exists).

List of batch transfer features:

  • Wildcard character support
  • Single file transfer possible as well
  • Default actions for common problems can be specified
  • Both recursive and non-recursive transfer are supported
  • Symbolic link alerts - custom symbolic link handling
  • Symbolic link infinite loop detection
  • Event driven - you always receive an event when any problem occures unless the session is no longer usable, making it possible to select the next step - skip, cancel, overwrite, etc.

C#

// downloads the whole directory "public" from the server into "C:\Temp" directory 
ftp.GetFiles("public", @"C:\Temp", FtpBatchTransferOptions.Recursive);

// uploads the whole directory "C:\Temp" to the server's current directory 
ftp.PutFiles(@"C:\Temp", ".", FtpBatchTransferOptions.Recursive);

VB.NET

' downloads the whole directory "public" from the server into "C:\Temp" directory 
ftp.GetFiles("public", "C:\Temp", FtpBatchTransferOptions.Recursive)

' uploads the whole directory "C:\Temp" to the server's current directory 
ftp.PutFiles("C:\Temp", ".", FtpBatchTransferOptions.Recursive)

See also: