Skip to content

FileExists (check for file)

ts
function FileExists(what: string): boolean;

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

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

Example

ts
if (FileExists('/var/data/report.csv')) {
  Log('File is ready.');
} else {
  Log('File not found, skipping.');
}