Xceed .NET Libraries Documentation
BeginReceiveMultipleFiles(String,String,Boolean,Boolean,AsyncCallback,Object) Method


Xceed.Ftp Assembly > Xceed.Ftp Namespace > AsyncFtpClient Class : BeginReceiveMultipleFiles(String,String,Boolean,Boolean,AsyncCallback,Object) 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.
Callback method to be called when the asynchronous operation is completed.
An object containing state information for this operation.
Begins the process of retreiving the files that match the provided file mask from the current working folder and stores them on the local system in the specified folder. Don't forget to call EndReceiveMultipleFiles!
Syntax
'Declaration
 
Public Function BeginReceiveMultipleFiles( _
   ByVal remoteFileMask As String, _
   ByVal localFolder As String, _
   ByVal recursive As Boolean, _
   ByVal recreateFolderStructure As Boolean, _
   ByVal callback As AsyncCallback, _
   ByVal state As Object _
) As IAsyncResult
'Usage
 
Dim instance As AsyncFtpClient
Dim remoteFileMask As String
Dim localFolder As String
Dim recursive As Boolean
Dim recreateFolderStructure As Boolean
Dim callback As AsyncCallback
Dim state As Object
Dim value As IAsyncResult
 
value = instance.BeginReceiveMultipleFiles(remoteFileMask, localFolder, recursive, recreateFolderStructure, callback, state)
public IAsyncResult BeginReceiveMultipleFiles( 
   string remoteFileMask,
   string localFolder,
   bool recursive,
   bool recreateFolderStructure,
   AsyncCallback callback,
   object state
)

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.
callback
Callback method to be called when the asynchronous operation is completed.
state
An object containing state information for this operation.

Return Value

An System.IAsyncResult representing the status of the asynchronous operation.
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 BeginChangeCurrentFolder%M:Xceed.Ftp.AsyncFtpClient.EndChangeCurrentFolder(System.IAsyncResult)% methods and/or BeginChangeToParentFolder%M:Xceed.Ftp.AsyncFtpClient.EndChangeToParentFolder(System.IAsyncResult)% 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 BeginGetCurrentFolder%M:Xceed.Ftp.AsyncFtpClient.EndGetCurrentFolder(System.IAsyncResult)% methods.

By default, if an error occurs during the multiple-file transfer, the entire operation will be aborted. To change this behavior, the FtpClient.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 FtpClient.SendTypeCommand property when calling the BeginReceiveMultipleFiles method during the initial listing phase.

When using a callback, the System.IAsyncResult is provided as a parameter. You should call EndReceiveMultipleFiles in that callback. When NOT providing a callback, you should keep the returned IAsyncResult and call EndReceiveMultipleFiles with it when ready to complete. In this later case, the call to EndReceiveMultipleFiles may block until the operation completes.

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

AsyncFtpClient Class
AsyncFtpClient Members