RenDir (rename a directory)¶
function RenDir(oldName, newName: string): boolean
The RenDir
function renames a directory. The oldName
directory must exist, and the newName
directory must not exist,
otherwise this command will fail and return false. If the command succeeds, and the directory is successfully renamed,
then this function will return true.
Example:
{
var cli = new SftpClient();
cli.Host = 'your.sftpserver.com:22';
cli.User = 'someusername';
cli.KeyFile = './my_id.rsa';
if (cli.Connect()) {
// ...
if (cli.RenDir('/docs/yours', '/docs/mine')) {
Log('directory was successfully renamed');
}
// ...
cli.Close();
}
cli = null
}