DIRECTORY( ) Function

Locates the specified directory.

DIRECTORY(cDirectoryName [, nFlags])

Parameters

  • cDirectoryName
    Specifies the name of the directory to locate. If you do not include an absolute path for the directory you specify, Visual FoxPro searches for the directory relative to the Visual FoxPro default directory.

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

    nFlags

    Description

    0

    DIRECTORY( ) returns False (.F.) if the directory exists but is marked with a Hidden or System attribute. (Default)

    1

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

Return Value

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

Remarks

The SET DEFAULT command specifies the Visual FoxPro default directory.

You can use the ADIR( ) function to determine specific attributes for the directory.

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

See Also

Reference

SET DEFAULT Command

ADIR( ) Function

CD | CHDIR Command

FILE( ) Function

GETDIR( ) Function

GETFILE( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)