DelTree (delete a directory tree)¶
function DelTree(directory: string): boolean
The DelTree
function deletes an directory, including (recursively) all files and sub-directories in it.
This function returns true if the directory tree was successfully and completely deleted, otherwise it 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.DelTree('/docs/letters')) {
Log('directory deleted');
}
// ...
cli.Close();
}
cli = null
}