# Command: dir

      DIR displays a list of files and subdirectories in a directory.

## Syntax:

      DIR [drive][path][filename] [/P] [/W] [/A[[:]attributes]]
          [/O[[:]sortorder]] [/S] [/B] [/L] [/Y] [/?]
          drive     The drive letter, e.g. C:
          path      The directory, e.g. \example\
          filename  The file to display, e.g. test.txt
                    [drive][path][filename]
                    Specifiy drive, directory, and/or files to list. (Could
                    be enhanced file specification or multiple filespecs.)

#### [Main menu] [top] (Syntax) [Options] [Comments] [Examples] [See also] [File]

## Options:

      /P  Displays one page of the listing at a time
      /W  Displays the listing in wide format
      /A:attributes
          Displays only the files and directories with the specified
          attributes.  Default is /a:hsdar.  You may use the following
          for attributes:
            h | -h  Hidden files                -h files that are not hidden
            s | -s  System files                -s files that are not system
                                                   files
            d | -d  Directories                 -d files
            a | -a  Files with the archive      -a files without the archive
                    bit                            bit
            r | -r  Read-only files             -r files that are not
                                                   read-only
      /O:sortorder
          Displays the listing in the specified order. Default is /O:g.
          You may use the following to specify the sort order:
            a | -a  Alphabetically (A-Z)        -a Alphabetically (Z-A)
            e | -e  By extension A-Z            -e Extension (Z-A)
            d | -d  By date and time            -d Date/time in reverse order.
            s | -s  By size (smallest-biggest)  -s Size (biggest-smallest)
            g | -g  Group directories first     -g Group directories last.
      /S  Displays files in specified directory and all subdirectories.
      /B  Uses bare format (no heading information or summary).
          This lists one name per line
      /L  Displays names in lowercase
      /Y or /4
          Display 4-digit year.
      /?  Shows the help

#### [Main menu] [top] [Syntax] (Options) [Comments] [Examples] [See also] [File]

## Comments:

      To customize the default appearance for dir, use the DIRCMD environment
      variable. For instance:
        SET DIRCMD=/w/p
      To override something set in DIRCMD, use a hypen ("-") on that switch
      at the command line. (for example /-w)
      DIR is a command internal to command.com and needs no other
      file in order to work.

#### [Main menu] [top] [Syntax] [Options] (Comments) [Examples] [See also] [File]

## Examples:

      dir c:\example /p
      dir c:\example /w
      dir c:\example /O: a
      dir c:\fdos | more

#### [Main menu] [top] [Syntax] [Options] [Comments] (Examples) [See also] [File]

## See also:

      set

#### [Main menu] [top] [Syntax] [Options] [Comments] [Examples] (See also) [File]

## File:

      Please read this command's lsm file also.
      You will find the updated version (internet) here and
      the version described in this manual page here.
      The lsm file contains information about the name of the programmer,
      the download site, and some other command related information.

#### [Main menu] [top] [Syntax] [Options] [Comments] [Examples] [See also] (File)

      Copyright © 1998 Jim Hall, updated 2007 by W. Spiegl.

      This file is derived from the FreeDOS Spec Command HOWTO.
      See the file H2Cpying for copying conditions.