DelDir (delete an empty directory)
ts
function DelDir(what: string): boolean;Attempts to delete the directory specified by what in the local file system. Returns true if the deletion is successful, or false if it fails.
WARNING
This function will fail if the directory is not empty. To recursively delete a directory and all its contents, use the DelTree function instead.
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
what | string | required | Path to a valid, existing empty directory you wish to delete |
| Return value | Explanation |
|---|---|
true | The directory was successfully deleted |
false | The operation failed; the directory was not deleted |
Example
ts
var result = DelDir('/home/user/emptyfolder');
if (result) {
Log('Directory deleted successfully.');
} else {
Log('Directory deletion failed.');
}