FileExists

Determines whether a file exists

Method Signature

FileExists(source=[string], allowRealPath=[boolean])

Arguments

Argument
Type
Required
Description
Default

source

string

true

The file path

allowRealPath

boolean

true

Whether to allow an absolute path as the path argument

true

Examples

Checks if file at the given path exists.

var myFile = "/path/to/the/file.jpg";
if( fileExists( expandPath( myFile ) ) ) {
	writeOutput( myFile & "exists!" );
}

Additional Examples

var filePath = "path/to/my/file.md";
if( fileExists( filePath ) ) echo;
"it exists";

Last updated

Was this helpful?