Tuesday, August 28, 2007

DOS - `dir`

`dir` - Displays a list of files and subdirectories in a directory.

Usage:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.

EXAMPLE:

C:\>dir /A
Volume in drive C is SYSTEM
Volume Serial Number is NRF9-8T9A

Directory of C:\

01/12/2007 02:12 PM 332 001.sql
04/26/2006 10:58 AM 0 AUTOEXEC.BAT
08/24/2005 04:18 PM 194 boot.ini
04/26/2005 10:58 AM 0 CONFIG.SYS
07/17/2004 04:03 PM dir Document
04/26/2007 11:03 AM dir Documents and Settings
02/13/2005 01:09 PM 561 INSTALL.LOG
01/26/2007 10:58 AM 0 IO.SYS
01/26/2007 10:58 AM 0 MSDOS.SYS
06/26/2002 02:19 AM 45,124 NTDETECT.COM
06/26/2002 02:19 AM 222,368 ntldr
02/10/2007 09:22 AM 399,491,072 pagefile.sys
04/20/2005 09:09 AM dir Program Files
04/26/2006 12:19 PM dir RECYCLER
02/22/2007 11:03 AM dir System Volume Information
03/23/2007 10:29 AM dir TMP
06/11/1985 05:34 PM 128,000 UNWISE.EXE
06/22/2007 05:55 PM dir WINDOWS
10 File(s) 400,158,372 bytes
8 Dir(s) 24,543,551,488 bytes free

C:\>

No comments: