function UploadWithPath(what, toWhere, skip)


The UploadWithPath function upload the file(s) specified in the what parameter (supports wildcards) to the toWhere destination directory on the remote file server, retaining the path of the original file and recreating it if necessary. The skip parameter is an integer number that instructs the function to skip the first N directories of the original path when rebuilding it into the destination path. This function is NOT recursive, therefore when using wildcards, this function will NOT upload matching files from sub-directories of the directory specified in the what parameter. For a recursive version of this function see the UploadWithPathR function.


Example:

{
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'someusername';
 scli.KeyFile = './my_id.rsa';
 if (scli.Connect()) {
  // perform your file transfers...
  // ...
  scli.UploadWithPath('./data/docs/*.docx', '/archive', 0); // uploads files to /archive/data/docs
  // ...
  scli.UploadWithPath('./data/docs/*.docx', '/archive', 1); // skip=1 means uploads files to /archive/docs
  // ...
  scli.Close();
 }
 scli = null
}