Purpose

Checks whether the file or directory exists on disk.

Syntax

bool FileOrDirectoryExists(String pathToFileOrDirectory);

  • pathToFileOrDirectory: The path to the file or directory to check.

Example

function Update()
{
    var dirExists = FileOrDirectoryExists("C:\\myFolder");
    var fileExists = FileOrDirectoryExists("C:\\myFolder\\myFile.txt");
    if(dirExists)
        Log("Directory exists");
    if(fileExists)
        Log("File exists");
}