DownloadR (recursive file download)

function DownloadR(what, toWhere: string): boolean

The DownloadR function download the file(s) specified in the what parameter and all of its sub-directories (wildcards are allowed) to the toWhere destination directory on the local computer.

Note

This function is recursive, therefore when using wildcards, this function will download matching files from all sub-directories of the directory specified in the what parameter.

Example:

{
  var cli = new SftpClient();
  cli.Host = 'your.sftpserver.com:22';
  cli.User = 'someusername';
  cli.KeyFile = './my_id.rsa';
  if (cli.Connect()) {
    // ...
    if (cli.DownloadR('/docs/*.xlsx', 'C:\\dest\\path')) {
      Log('file(s) downloaded');
    }
    // ...
    cli.Close();
  }
  cli = null
}