This code returns a true/false if a specified drive/directory/pathname exists.
This is a small, fast routine.
Inputs
A string containing a pathname must be passed.
If checking for a directory you must also set the second optional argument to True.
Assumes
'To check if a specific drive letter exists, use strings for the PathName argument that look like this (the strings themselves should not include quotation marks):
'
'"c:"
'"c:\"
'
'Eg. DriveStat= File_Exists("c:\")
'(NOTE: The backslash is optional.)
'
'To check if a specific directory exists, use strings for the PathName argument that look like this (the strings themselves should not include quotation marks). ALSO, you must use True for the second optional argument, otherwise the function will not work on all directories.:
'
'"c:\temp\"
'"c:\windows\"
'
'Eg. DirStat = File_Exists("c:\temp", True)
'
'To check if a specific file exists, use strings for the PathName argument that look like this (the strings themselves should not include quotation marks):
'
'"c:\temp\somefile.exe"
'"c:\windows\notepad.exe"
'
'Eg. FileStat = File_Exists("c:\windows\win.ini")
Returns
True if the pathname and/or file exists.
Otherwise it returns false.
API Declarations