Download (download files)¶
function Download(what, toWhere: string): boolean
The Download
function download the file(s) specified in the what
parameter (wildcards are allowed)
to the toWhere
destination directory on the local computer.
Attention
This function is not recursive, therefore when using wildcards, this function will not download
matching files from sub-directories of the directory specified in the what
parameter. For a recursive
version of this function see the DownloadR function.
Example:
{
var cli = new SftpClient();
cli.Host = 'your.sftpserver.com:22';
cli.User = 'someusername';
cli.KeyFile = './my_id.rsa';
if (cli.Connect()) {
// ...
if (cli.Download('/docs/*.xlsx', 'C:\\dest\\path')) {
Log('file(s) downloaded');
}
// ...
cli.Close();
}
cli = null
}