Function File() Foundation
Determines whether the specified file exists.
File( <cFilename>, [<cAttribute>] ) --> lExist
File( @<cFilename>, [<cAttribute>] ) --> lExist
Attribute | Meaning |
---|---|
D | Directory - File is a directory |
H | Hidden - Hidden file |
S | System - System file |
The return value of File() is .T. (true) when a file was found corresponding to the specification in <cFilename>. When no file was found, File() returns the value .F. (false).
The environment function File() tests whether one or more files exist matching the specification <cFilename>. When the path is not specified in <cFilename>, File() uses the settings returned by SET DEFAULT and SET PATH and aborts the search with the first match. The system path defined at the operating system level with SET PATH is not searched.
// The example shows the dependence between File() and the
// settings with SET PATH and SET DEFAULT
PROCEDURE Main
? File("address.dbf") // result: .F.
? File("\xpp\samples\data\misc\address.dbf") // result: .T.
SET PATH TO \xpp\samples\data\misc
? File("address.dbf") // result: .T.
SET PATH TO
SET DEFAULT TO \xpp\samples\data\misc
? File("address.dbf") // result: .T.
? File("*.DBF") // result: .T.
SET DEFAULT TO
? File( "\xpp\samples\data\misc", "D" ) // result: .T.
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.