DelDir (delete a directory)¶
function DelDir(directory: string): boolean
The DelDir
function deletes an empty directory. If the directory is not empty, this function will fail.
This function returns true if the directory was successfully deleted. If the directory was not empty, or if for any other reason it could not be deleted, this function returns false.
Example:
{
var cli = new SftpClient();
cli.Host = 'your.sftpserver.com:22';
cli.User = 'someusername';
cli.KeyFile = './my_id.rsa';
if (cli.Connect()) {
// ...
if (cli.DelDir('/docs/letters')) {
Log('directory deleted');
}
// ...
cli.Close();
}
cli = null
}