Dir (DOS command)

From Free net encyclopedia

(Redirected from Dir (DOS Command))

Template:Lowercase In computer software, specifically the command line interface (CLI) of the DOS operating system, dir is a command used for file and directory listing. It is analogous to the Unix ls command.

dir has existed as a DOS command since the initial release of MS-DOS. It is built in to the DOS command shell; in contrast, ls is a standalone program.

Syntax

dir <options> <filelist>

Options

Particular implementations of the DOS operating system may provide more options; these are only the most common.

  • /w  : Wide list format
  • /p  : Pause at every page
  • /s  : Also look in subdirectories
  • /a[xx] : Display files with the specified attributes (options may be combined, such as /arh, to show read-only, hidden files)
  • /o[xx] : Modifies sort order (options may be combined, such as /ons, to sort name first then size)

Attribute options:

  • /aa  : Display files with Archive attribute
  • /ar  : Display files with Read-Only attribute
  • /as  : Display files with System attribute
  • /ah  : Display files with Hidden attribute
  • /a-a  : Display files without Archive attribute
  • /a-r  : Display files without Read-Only attribute
  • /a-s  : Display files without System attribute
  • /a-h  : Display files without Hidden attribute

Sorting options:

  • /on  : Sort on Name order
  • /od  : Sort on Date order
  • /oe  : Sort on Extension order
  • /og  : Sort on Directory order
  • /os  : Sort on Size order
  • /o-n  : Reverse Sort on Name order
  • /o-d  : Reverse Sort on Date order
  • /o-e  : Reverse Sort on Extension order
  • /o-g  : Reverse Sort on Directory order
  • /o-s  : Reverse Sort on Size order

Sample listing

This sample is taken from a Windows 2000 implementation of the MS-DOS CLI.

C:\>dir
 Volume in drive C is MAIN W2K
 Volume Serial Number is 2326-30E6
 
 Directory of C:\
 
11/17/2001  09:40p             257,787 INF000.SWP
04/16/2002  10:12p                 446 VIRUSLOG.TXT
05/19/2002  04:34p      <DIR>          filelib
11/22/2001  05:17p                 228 BOOT.BAD
11/22/2001  05:10p               1,663 MSDOS.BAD
12/09/2001  09:07a               8,681 SCANDISK.LOG
11/22/2001  05:40p               1,775 MSDOS.SYS
01/03/2002  12:05a      <DIR>          eBooks
11/22/2001  04:59p                 185 BOOT.w98
11/22/2001  05:12p                 253 BOOT.w2k
03/08/2002  02:08p      <DIR>          WINNT
11/22/2001  02:17p      <DIR>          Games
11/17/2001  10:04p      <DIR>          Documents and Settings
05/12/2002  05:57p      <DIR>          dostemp
10/14/2001  09:51a      <DIR>          Downloads
08/01/2002  07:15p                 160 AUTOEXEC.BAT 
12/09/2001  05:24p      <DIR>          Backup
10/14/2001  09:25a      <DIR>          MSDOS7
09/30/2002  03:48p      <DIR>          cygwin
11/25/2002  03:02a      <DIR>          My Documents
03/08/2002  02:45p      <DIR>          Program Files
03/31/2002  07:41p      <DIR>          Temp
              9  File(s)      2,674,060 bytes
              16 Dir(s)   2,672,476,160 bytes free

de:Dir