Downloads the remote files or directories on the list to the specified local directory using multiple threads.
public FileSystemTransferStatistics Download(
IEnumerable remoteFilesToTransfer,
string localPath,
TransferOptions options,
int threads,
bool waitForThreads
)
Public Function Download( _
ByVal remoteFilesToTransfer As IEnumerable, _
ByVal localPath As String, _
ByVal options As TransferOptions, _
ByVal threads As Integer, _
ByVal waitForThreads As Boolean _
) As FileSystemTransferStatistics
public:
FileSystemTransferStatistics Download(
IEnumerable^ remoteFilesToTransfer,
String^ localPath,
TransferOptions^ options,
int threads,
bool waitForThreads
);
Parameters
- remoteFilesToTransfer
- The list of files and directories to download,
This list can contain String and FileInfoBase objects. (e.g.
Download(new string[] {"/dir/file1", "file2", "dir1" }...)
or Download(new object[] {"/dir/file1", fileInfo2, dirInfo1 }...)
) - localPath
- The path of the local directory to receive files from the server.
- options
- The transfer options object which provides many settings to control the file transfer process.
- threads
- The number of threads used for the simultaneous file transfer.
- waitForThreads
- A boolean value indicating whether to wait for the completion of all threads. If this parameter is true, this method blocks the caller process's execution until all threads have completed; otherwise, this method immediately returns the control to the caller process.
Return Value
A
FileSystemTransferStatistics object that contains transfer statictics and a list of processed files and directories.
Use 50 threads to download files simultaneously from the local disk.
using ComponentPro;
using ComponentPro.IO;
using ComponentPro.Net;
...
using (Ftp ftp = new Ftp())
{
// Connect to the FTP server.
ftp.Connect("localhost");
// Authenticate.
ftp.Authenticate("test", "test");
string[] filesAndFoldersToDownload = new string[]
{
@"/data",
@"/myfolder/content",
@"/myfiles/file1",
@"/myfiles/file2"
};
ftp.Download(
filesAndFoldersToDownload, // List of files and folders to download.
"c:\\temp", // The local directory to receive files.
new TransferOptions(),
50, // Use 50 threads
true // Wait until all the threads complete.
);
}
Imports ComponentPro
Imports ComponentPro.IO
Imports ComponentPro.Net
...
Using ftp As New Ftp()
' Connect to the FTP server.
ftp.Connect("localhost")
' Authenticate.
ftp.Authenticate("test", "test")
Dim filesAndFoldersToDownload() As String = { "/data", "/myfolder/content", "/myfiles/file1", "/myfiles/file2" }
ftp.Download(filesAndFoldersToDownload, "c:\temp", New TransferOptions(), 50, True) ' Wait until all the threads complete. - Use 50 threads - The local directory to receive files. - List of files and folders to download.
End Using