Downloads files or directories in the specified list to the specified local directory.
public FileSystemTransferStatistics Download(
IEnumerable remoteFilesToTransfer,
string localPath,
TransferOptions options
)
Public Function Download( _
ByVal remoteFilesToTransfer As IEnumerable, _
ByVal localPath As String, _
ByVal options As TransferOptions _
) As FileSystemTransferStatistics
public:
FileSystemTransferStatistics Download(
IEnumerable^ remoteFilesToTransfer,
String^ localPath,
TransferOptions^ options
);
Parameters
- remoteFilesToTransfer
- The list of remote 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 }...)
). This parameter cannot be a null reference. - localPath
- The path of the local directory on the disk file system to receive files from the remote server.
- options
- The transfer options object which provides many settings to control the file transfer process.
Download files 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:\\dest", // The local directory to receive files and folders.
new TransferOptions()
);
}
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:\dest", New TransferOptions()) ' The local directory to receive files and folders. - List of files and folders to download.
End Using