See Also: File I/O Commands, Get_Directory, Make_Directory, Make_Temp_File, Remove_Directory, Valid_Drive, Get_File_Path
Checks whether a file or folder exists.
File_Exist {target} {result}
Where
{target} is the specification of a file or folder, optionally including a path.
{result} is a Boolean variable that is set True if {target} exists, or False if it does not.
File_Exist returns a True if the specified target exists, and False if it does not. File_Exist will look for the target in the current working folder, unless a path name is provided as part of the file or folder specification. You may use any valid Windows file or folder specification (excluding wildcard characters), including universal naming convention (UNC).
The sample checks whether the file "hello.txt" exists in the current working folder (since a path is not specified).
Procedure DoesFileExist
Boolean bFileExists
File_Exist "hello.txt" bFileExists
End_Procedure
send DoesFileExist
The sample checks whether the folder "C:\temp" exists.
Procedure DoesFileExist
Boolean bFileExists
File_Exist "C:\temp" bFileExists
End_Procedure
send DoesFileExist
No wildcards may be used.
File_Exist looks for the file in the current folder if no path is specified. You can use Get_Current_Directory to query the current folder.
It does not use the DFPATH Registry key value.
When testing for the existence of a folder, {target} should not have a trailing backslash.