Xceed .NET Libraries Documentation
ReceiveMultipleFiles Method


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class : ReceiveMultipleFiles Method
The file mask of the remote files to receive. This parameter can include a filtering mask to limit the files that are received. For example, if System.String.Empty is specified, the entire contents of the current working folder will be received. If "*.txt" is used, all the files in the current working folder that have the TXT extension will be received. Some FTP servers may be case-sensitive!
The path and name of the local folder where the files will be stored.
true if the files in child folders should also be received; false otherwise.
true if the remote directory structure should be recreated on the local machine; false otherwise.
Receives the files that match the provided file mask from the current working folder and stores them on the local system in the specified folder.
Syntax
'Declaration
 
Public Sub ReceiveMultipleFiles( _

   ByVal remoteFileMask As String, _

   ByVal localFolder As String, _

   ByVal recursive As Boolean, _

   ByVal recreateFolderStructure As Boolean _

) 
'Usage
 
Dim instance As FtpClient

Dim remoteFileMask As String

Dim localFolder As String

Dim recursive As Boolean

Dim recreateFolderStructure As Boolean

 

instance.ReceiveMultipleFiles(remoteFileMask, localFolder, recursive, recreateFolderStructure)
public void ReceiveMultipleFiles( 

   string remoteFileMask,

   string localFolder,

   bool recursive,

   bool recreateFolderStructure

)

Parameters

remoteFileMask
The file mask of the remote files to receive. This parameter can include a filtering mask to limit the files that are received. For example, if System.String.Empty is specified, the entire contents of the current working folder will be received. If "*.txt" is used, all the files in the current working folder that have the TXT extension will be received. Some FTP servers may be case-sensitive!
localFolder
The path and name of the local folder where the files will be stored.
recursive
true if the files in child folders should also be received; false otherwise.
recreateFolderStructure
true if the remote directory structure should be recreated on the local machine; false otherwise.
Exceptions
ExceptionDescription
Cannot perform the requested operation because the FTP client is in an invalid state.
An error reply was returned by the FTP server.
An I/O error has occurred.
A fatal FTP-specific error has occurred.
Remarks

If a folder is specified in remoteFileMask, for example "MyFiles/*" and recreateFolderStructure is set to true, the "MyFiles" folder will be recreated locally in localFolder. If only a file mask is specified in remoteFileMask, the files/folders will be recreated directly in localFolder.

By default, the files that match the provided file mask will be received from the current working folder. If you want to receive the files from another location, you could use the ChangeCurrentFolder and/or ChangeToParentFolder methods to change the current working folder. Absolute paths can also be provided, however some FTP servers might not support absolute paths and different server types may have different ways of representing absolute paths.

The current working folder can be retrieved via the GetCurrentFolder method.

By default, if an error occurs during the multiple-file transfer, the entire operation will be aborted. To change this behavior, the MultipleFileTransferError event must be handled and its Action property set to either Retry or Ignore.

The TYPE command will be sent regardless of the value of the SendTypeCommand property when calling the ReceiveMultipleFiles method during the initial listing phase.

The ReceiveMultipleFiles method will send the LIST, RETR, PASV or PORT, TYPE, PWD and CWD commands to the FTP server.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FtpClient Class
FtpClient Members