Display a list of files and subdirectories in a directory (folder).


dir [filename] [/b] [/c] [/d] [/l] [/n] [/p] [/q] [/s] [/w] [/x]

    [/4] [/a:attributes] [/o:sortorder] [/t:timefield]


Without any options, dir displays the disk’s volume label and serial number, a list of all files and subdirectories (except hidden and system files) in the current directory, file/directory size, date/time of last modification, the long filename, the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk.

If you specify one or more file or directory names (optionally including drive and path, or the full UNC path to a shared directory), information for only those files or directories will be listed.

Wildcards (* and ?) can be used to display a subset listing of files and subdirectories.

dir accepts the following options:


Display only files with/without specified attributes (using - as a prefix specifies “not,” and a colon between the option and attribute is optional). See “Attrib” in Chapter 4 for more information on attributes.


Use bare format (no heading information or summary). Use with /s to find a filename.


Display compression ratio of files on Dblspace or DrvSpace drives, assuming 16 sectors/cluster.


Same as /w, except files are sorted vertically.


Use lowercase.


List files in a “new” Unix-like display, where filenames are shown on the right.


List files in sorted order ...

Get Windows XP in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.