JavaScript Editor js editor     Web development 



Main Page

Locates the specified file.

FILE(cFileName [, nFlags])

Parameters

cFileName


Specifies the name of the file to locate. cFileName must include the file extension. 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. If you do not include a path with the file name, Visual FoxPro searches in the default directory for the file. If it cannot find the file in the default directory, Visual FoxPro searches along the Visual FoxPro path, which is established with SET PATH.
nFlags


Specifies the kind of value FILE(В ) returns when the file exists but might be marked with the Hidden or System attribute. The following table lists the values for nFlags.

nFlags Description

0

FILE(В ) returns False (.F.) if the file exists but is marked with a Hidden or System attribute. (Default)

1

FILE(В ) returns True (.T.) if the file exists, regardless of its file attributes. Setting nFlags to 1 allows you to check for hidden or system files.

Return Value

Logical data type. FILE(В ) returns True (.T.) if the specified file is found on disk; otherwise, it returns False (.F.).

Remarks

You can use the ADIR(В ) function to retrieve specific attributes for the file.

You can use the CD and CHDIR commands to switch to hidden files and directories.

Example

The following example displays a message indicating if the Visual FoxPro resource file exists in the Visual FoxPro startup directory.

В Copy Code
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



JavaScript Editor js editor     Web development