The Dir command provides a table of contents of the specified directory.
- Use the current drive.
- Use the current directory.
- Display information about all files.
- Display information about files with null extensions only.
The optional drive parameter refers to the drive letter of the disk holding the directory you wish to read. It must be followed by a colon.
Path indicates the sequence of directories within which the information can be found. A backslash (\\) must precede each directory name. If no backslash is present at the beginning of the series of directory names, BR automatically begins its search with the current directory path.
Filename allows you to access information about a specific file (or files) instead of the entire directory. You may use wildcard characters ? and * in these file names. See the Definitions chapter for more information about wildcards.
.Ext is a period and an optional extension which may be added to the file name.
>Redirected output File saves directory information that would normally be displayed on the screen to a text file. >>Redirected output File appends directory information to an existing text file.
PRINT sends the same information to the printer.
Redirected output File and PRINT are mutually exclusive - you may use either one, but not both.
Several optional parameters, when separated from the rest of the command with a dash, can follow the DIR command:
|A||display directory information about files with the archive bit on. The archive bit automatically sets to "on" whenever a file is changed. The operating system's back-up utility or the -A option of the COPY command turns it off (see COPY command). This option is completely ignored by Linux systems.|
|L||display long filenames in addition to the normal DOS style directory. List the permissions for each file on Linux versions.|
|O||sort the directory output in alphabetical order.|
|P||pause scrolling after a full screen of information has been displayed. Press <ENTER> for next screen.|
|W||display names in four columns across the width of the screen. One name per line appears when directory I information is redirected to a file. This option sorts the output and uses the long filename format. -W works like -C, except the sequence of filenames is across instead of down.|
|U||unadorned - display directory content without the extended filenames|
|C||print in columnar sorted order with a trailing / symbol for directories and a trailing * for executables.|
|L||display long filenames in addition to the normal DOS style directory. Show permissions on the left and long filenames on the right.|
|B||display only the bare long filename, similar to DOS.|
Comments and Examples
The Dir command lists all the files in the specified drive and directory. In addition to file names and extensions, the list tells you the length of the file in bytes, and the date and time the file was created or most recently updated.
You can obtain information about only one file. You can also obtain information about a group of files with similar names by specifying a particular file name using wildcard characters. The screen then displays information for the specified files.
The following example accesses information about all files in the directory DAVID on the disk in drive B:
The next command finds information about all files with the extension .BRO in the directory DAVID:
The following example accesses the file names of all files with the archive bit on in the current directory on drive B; the information is displayed in four columns across the width of the screen:
DIR B: -AW