help.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DIR
Notes  Examples
────────────────────────────────────────────────────────────────────────────
 
                                    DIR
 
Displays a list of the files and subdirectories that are in the directory
you specify.
 
When you use DIR without parameters or switches, it displays the disk's
volume label and serial number; one directory or filename per line,
including the filename extension, the file size in bytes, and the date and
time the file was last modified; and the total number of files listed, their
cumulative size, and the free space (in bytes) remaining on the disk.
 
Syntax
 
    DIR [drive:][path][filename] [/P] [/W]
    [/A[[:]attributes]][/O[[:]sortorder]] [/S] [/B] [/L] [/C]
 
Parameters
 
[drive:][path]
    Specifies the drive and directory for which you want to see a listing.
 
[filename]
    Specifies a particular file or group of files for which you want to see
    a listing.
 
Switches
 
/P
    Displays one screen of the listing at a time. To see the next screen,
    press any key.
 
/W
    Displays the listing in wide format, with as many as five filenames or
    directory names on each line.
 
/A[[:] attributes]
    Displays only the names of those directories and files with the
    attributes you specify. If you omit this switch, DIR displays the names
    of all files except hidden and system files. If you use this switch
    without specifying attributes, DIR displays the names of all files,
    including hidden and system files. The following list describes each of
    the values you can use for attributes. The colon (:) is optional. Use
    any combination of these values, and do not separate the values with
    spaces.
 
    H
        Hidden files
 
    -H
        Files that are not hidden
 
    S
        System files
 
    -S
        Files other than system files
 
    D
        Directories
 
    -D
        Files only (not directories)
 
    A
        Files ready for archiving (backup)
 
    -A
        Files that have not changed since the last backup
 
    R
        Read-only files
 
    -R
        Files that are not read-only
 
/O[[:] sortorder]
    Controls the order in which DIR sorts and displays directory names and
    filenames. If you omit this switch, DIR displays the names in the order
    in which they occur in the directory. If you use this switch without
    specifying sortorder, DIR displays the names of the directories, sorted
    in alphabetic order, and then displays the names of files, sorted in
    alphabetic order. The colon (:) is optional. The following list
    describes each of the values you can use for sortorder. Use any
    combination of the values, and do not separate these values with
    spaces.
 
    N
        In alphabetic order by name
 
    -N
        In reverse alphabetic order by name (Z through A)
 
    E
        In alphabetic order by extension
 
    -E
        In reverse alphabetic order by extension (Z through A)
 
    D
        By date and time, earliest first
 
    -D
        By date and time, latest first
 
    S
        By size, smallest first
 
    -S
        By size, largest first
 
    G
        With directories grouped before files
 
    -G
        With directories grouped after files
 
    C
        By compression ratio, lowest first.
 
    -C
        By compression ratio, highest first.
 
/S
    Lists every occurrence, in the specified directory and all
    subdirectories, of the specified filename.
 
/B
    Lists each directory name or filename, one per line (including the
    filename extension). This switch displays no heading information and no
    summary. The /B switch overrides the /W switch.
 
/L
    Displays unsorted directory names and filenames in lowercase. This
    switch does not convert extended characters to lowercase.
 
/C[H]
    Displays the compression ratio of files compressed using DoubleSpace or
    DriveSpace, based on an 8K cluster size. The optional H switch displays
    the compression ratio of files compressed using DoubleSpace or
    DriveSpace, based on the cluster size of the host drive. The /C[H]
    switch is ignored when used with the /W or /B switch.
 
Related Commands
 
For information about displaying the directory structure of a path or disk,
see the <TREE> command.
 
For information about compressing disks, see the <DRVSPACE> command.
 
                                      ♦