DIR (2000/XP/Vista, ver:6.0.6001)

Article is compatible with Microsoft Windows 2000/XP/Vista [Version 6.0.6001], Command Line.

DIR is a standard utility that is used to navigate the Windows operating system. It is primarily used to list files, directories, and subdirectories, and also information about them such as modification date/time, size, and more. You can also list files with attributes, such as hidden and system files, and there are many switches that allow you to control to “look” of your results.

Important: Some of the options for DIR may be enabled by default even though you can’t see them. For instance, the /C and /N options are usually invoked when you type DIR, whether they are specified or not. The switches are found within your Windows DIRCMD environment variable. To override any invoked switches, simply use a hypen (” - “) before the option’s letter. Example: DIR /-N.

Syntax:

DIR [ drive : ] [ path ] [ file-name ] [ /A { : attributes } ] [ /B ] [ /C ] [ /D ] [ /L ] [ /N ] [ /O { : sort} ] [ /P ] [ /Q ] [ /S ] [ /T { : timefield } ] [ /W ] [ /X ] [ /4 ]
DIR /?

drive A drive or volume.
file-name The name(s) of file(s) you want to list.
path The directory path.
- The “not” prefix.
/A [ : attributes ] Includes files with attributes that you can specify:

D Directories S System files
A Archive files R Read-only files
H Hidden files
/B Displays output with “bare” formatting- with no headings or descriptions.
/C Used to display the comma in file-size thousands as a separator. This is set by default; to override, use /-C and the commas will be removed.
/D Displays results in a wide-listing columnar format. Entries are listed and alphabatized from left-to right and divided per column.
/L Converts entries’ output to all lower-case.
/N Formats the results as a long list (a newer style), with file-names on the right. This is set by default; to override, use /-N.
/O [ : sort ] Allows you to specify a organization method for your results:

N Sort alphabetically by file-name S Sort alphabetically by file size- small to large.
E Sort alphabetically by file extension. D Sort alphabetically by date/time- old to new.
G Group the directories first in results. - Used to reverse the listing order.
/P Displays a pause after each screen has filled with information; this ensures that you can see all of your results.
/Q Includes the name of the file-owner with query’s results.
/S Displays files in the current directory and in any of its subdirectories. Similar to a TREE command, but includes more information about individual entries.
/T [ : timefield ] Allows you to specify what appears in the date/time field. Can be used with /O [ : sort ] to sort by the time-stamp.

C Shows the files’ creation time-stamp.
A Shows the files’ last-accessed time-stamp.
W Shows the files’ last-written-to time-stamp (Default).
/W Displays results in a wide-listing columnar format. Entries are listed and alphabatized from left-to right across all columns.
/X Extracts the 8-dot-3 file names from entries that are longer than eight characters or contain spaces, and displays them with the results. Same viewing format as the /N option.
/4 Ensures that the year information is displayed with four digits.
/? Displays the built-in help information.


Example:

  • DIR /A /L /O:E /P /X
    This will show me what files and folders are in my current directory (C:\), to include hidden, system, archived, and read-only files/folders. My results will be in all lower-case- making them easier to read; and all the entries will be organized by file-extension, with their respective 8-dot-3 file-names listed as well (if available). Lastly, if my screen fills up with text, I am prompted to continue- for every screen; this way, I don’t miss any results.
Reblog this post [with Zemanta]

Popularity: 21% [?]

  • MySpace
  • Blogger Post
  • Digg
  • Facebook
  • Twitter
  • Google Bookmarks
  • Share/Bookmark

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>