DIR or DIRECTORY Command

Example   See Also

Displays information about the files in a directory.

Syntax

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

Arguments

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:

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