Skip to content

DirExists (check for directory)

ts
function DirExists(what: string): boolean;

Returns true if the directory specified by what exists on the local file system, false otherwise.

ParameterTypeRequirementExplanation
whatstringrequiredPath to the directory to check
Return valueExplanation
trueThe directory exists
falseThe directory does not exist, the path points to a file, or the check failed

Example

ts
if (!DirExists('/var/data/output')) {
  MakeDir('/var/data/output');
}