DIR or DIRECTORY Command

Displays information about the files in a directory.

DIR | DIRECTORY [ON Drive] [[LIKE] [Path] [FileSkeleton]]
   [TO PRINTER [PROMPT] | TO FILE FileName]

Parameters

  • ON Drive
    Specifies the name of the drive on which the directory is located.

  • [LIKE] [Path] [FileSkeleton]
    Specifies the path to the directory containing the files. The path can include the drive name if you omit ON Drive.

    Include FileSkeleton to display information about file types other than tables. FileSkeleton is a file specification skeleton that supports wildcards. For example, to list all program files in the current directory, issue the following command:

    DIR *.PRG
    

    In Visual FoxPro, you can issue the following command to list all files without extensions:

    DIR *.
    
  • TO PRINTER [PROMPT]
    Directs output from DIRECTORY to a printer.

    In Microsoft Visual FoxPro, you can include the optional PROMPT clause to display a print dialog box before printing starts. In this dialog box you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place the PROMPT keyword immediately after TO PRINTER.

  • TO FILE FileName
    Directs output from DIRECTORY to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

Use DIR to display information about files.

DIR without the LIKE clause or a skeleton displays the following:

  • Names of all tables in the directory.
  • Number of records in each table.
  • Date each table was last updated.
  • Size of each table in bytes (tables in the original Microsoft FoxBASE format are noted as such).
  • If each table is part of a database.
  • The total size in bytes the tables occupy on disk (not including associated .fpt memo files).
  • Number of tables displayed.
  • Total number of bytes remaining on the disk.

The table information for the default drive and directory is displayed unless otherwise specified with Drive or Path or both.

Example

CLEAR
DIR  && Display tables in the current directory
DIR *.CDX && Display index files in the current directory
DIR A*.DBF  && Display tables that begin with A
DIR *.*  && Display all files, including those without extensions

See Also

DISPLAY FILES | DIRECTORY( ) Function