Delete (delete a file)¶
function Delete(filePath: string): boolean
The Delete
function deletes a file, if it exists.
This function returns true if the file was successfully 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.Delete('/docs/budget.xlsx')) {
Log('file deleted');
}
// ...
cli.Close();
}
cli = null
}