DIR

Type: Internal (1.0 and later)

Syntax:

DIR [d:][path][filename] [/A:(attributes)] [/O:(order)] [/B][/C][/CH][/L][/S][/P] [/W]

Purpose: Displays directory of files and directories stored on disk.

Discussion

In addition to files and directories, DIR also displays both the volume name and amount of free storage space on the disk (if there are files stored in the current directory). Note that both of these are for the entire DISK, not just for the path you specified.

The DIR command is also useful if you want to know what directories have been created on the specified disk. The directories will be displayed along with the files on the disk. They can be identified by the DIR label that follows the directory name.

Wildcard characters (? and *) can be used to specify groups of files.

When you use the DIR command, it will display all files that match the path and filename specifications, along with their size in bytes and the time and date of their last modification. If you don`t enter one of the options, the entire list will be displayed, even if the list is too long to fit on one screen. To limit the amount of data displayed, use either of the two options described below.

Options

/A:attributes

Only the files whose attributes match the ones you specify will be displayed. You can enter a sequence of attributes after the colon. It is not necessary to enter spaces between entries. This option is available with DOS Versions 5 and 6.

The possible attributes are:

H|-H - Hidden (or not hidden) files.
S|-S - System (or non system) files.
D|-D - Directories (or files only).
R|-R - Read-only (or read/write) files.
A|-A - Archivable (or already archived) files.

/O:order

Allows you to specify the order in which the entries will be displayed. This option is available with DOS Versions 5 and 6.

The possible options are:

N|-N - By name (alphabetical or reverse alphabetical).
E|-E - By extension ( alphabetical or reverse alphabetical).
D|-D - By date and time (chronologically or reverse).
S|-S - By size (increasing or decreasing).
C|-C - Sorts by DoubleSpace compression ratio lowest to highest or highest to lowest. (Version 6.0 only)
G|-G - Group directories (before, or after) other files.

Other Switches

/B - (Bare format) Displays only file names.
/C - Displays the compression ratio of files compressed using DBLSPACE. This option is available with DOS Version 6.
/CH - Displays the compression ratios of files on a DoubleSpace volume. Cannot be used at the same time as the /C option. This option is available with DOS Version 6.
/L Information is displayed in lowercase letters. This option is available with DOS Versions 5 and 6. /S Displays file entries in the specified directory and all subdirectories located below it hierarchically. /P Pauses when the screen is full. Press any key to display another screen full of data. /W Displays only filenames and directory names (without the added information about each file) in a five-wide display format.

Examples

To display only files with the .TXT filename extension on the current drive that begin with the letters FIL, enter

dir fil*.TXT

To display only files on drive C that have no filename extension, enter

dir c:*.

This form of the DIR command will also display directories. They can be identified by the DIR label that follows the directory name.


Return to Mission Control home page         Return to DOS Command Index