Skip to content

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.

ParameterTypeRequirementExplanation
whatstringrequiredPath to a valid, existing empty directory you wish to delete
Return valueExplanation
trueThe directory was successfully deleted
falseThe 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.');
}