FileExists

From VLECK
Jump to: navigation, search

Checks if a file or directory exists or not.

Syntax

Result = FileExists(FileName);

Return Value

If the file exists, the return value is 1 else 0.

Parameters

FileName either the name of a file or a directory. In the latter case, the name should not end with a path delimiter ("\"), but a dot is permissable. The name is not case sensitive.


Example

// ordinary file:
FileExists("F:\pagefile.sys")
1

// non-existent file:
FileExists("F:\pagefile.foo")
0

// directory:
FileExists("F:\downloads")
1

// ditto, ending on backslash:
FileExists("F:\downloads\")
0

// ditto, ending on dot:
FileExists("F:\downloads\.")
1

//neither form can detect the root path:
FileExists("F:\", "F:", "F:\.")
0	0	0