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.


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.


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