function Rename(what, toWhere)


The Rename function renames or moves a file system object (file or folder) on the remote file server. It returns true if the object is successfully renamed/moved, otherwise it returns false.


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.Rename('/docs/bio.docx', '/docs/bio.docx.bak');
  // ...
  scli.Close();
 }
 scli = null
}