FILE( ) Function

Returns true (.T.) if the specified file is found on disk.

FILE(cFileName)

Return Values

Logical

Parameters

  • cFileName
    Specifies the name of the file to locate. cFileName must include the file's extension. Visual FoxPro looks in the default directory for the file. If the file cannot be found in the default directory, Visual FoxPro searches along the Visual FoxPro path, which is established with SET PATH.

    You can include a path with the file name to search for a file in a directory or on a drive other than the current directory or drive.

Remarks

Use FILE( ) to find a file on disk. FILE( ) returns true (.T.) if the file can be found; otherwise FILE( ) returns false (.F.).

Example

The following example displays a message indicating if the Visual FoxPro resource file is present in the Visual FoxPro start up directory.

SET PATH TO HOME( )
CLEAR
IF FILE('foxuser.dbf')
   WAIT WINDOW 'Visual FoxPro resource file present'
ELSE
   WAIT WINDOW 'Visual FoxPro resource file not present'
ENDIF

See Also

FULLPATH( ) | GETFILE( ) | LOCFILE( )