Name

dir

Synopsis

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

Syntax

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

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

Description

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:

/a:attributes

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.

/b

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

/c

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

/d

Same as /w, except files are sorted vertically.

/l

Use lowercase.

/n

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

/o:sortorder

List files in sorted order ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.