Thursday, September 20

Displaying list of files

DIR
It displays list of files in a directory.
Syntax
DIR [drive:] [path] [file name] [/P] [/W] [/A[attributes]] [/B] [/O[order]][/S]
[Drive:] [path] [file name] :  drive, directory and file name to display
Where,
/P      :   pause after each screenful of information. (i.e. shows Pagewise list of files) 
             This switch prevents to scroll up the file name before you are able to view them. File name, file size date and time of creation will be displayed.
/W     : displays the list of files in a wide format (five files names per line) that includes file name, extension and directory names only. This switch enables you to view many files at once.
/A:     : displays only those files with specified attributes, where attrib is a letter indicating the type of attribute to include in the listing.
Letter used for different types of attributes are :
A = Files with archive bit set
D = subdirectories only
R = files marked read-only
H = Hidden files
S = System files
/B : Displays files and directory names only
/L : Displays file names in lower case
/O : Order
List files in sorted order where order is a letter indicating one of the following :
N =  sorts alphabetically by Name
E  =  sorts alphabetically file Extension
D  =  sorts by Date and time, earliest first
S  =  sorts by file size, smallest first 
G =  sorts with directories Grouped before files.using 

  • using DIR subdirectories names are also listed.
  •  DIR command can be used with wild card characters and switches.
  • DIR shows file names (in a single column) size of file in Bytes, date and time of creation.
  • At the end of list of files, the total number of files present in the directory and unused disk space in bytes is also indicated.
Example 1

C:\> DIR
It displays the list of files and name of directories of root directory of C : drive. 

Example 2
C:\.>DIR/P
It lists all the files and directories of dive C: and pauses the display each time the screen fills up with file names
  • when the number of files is large (i.e. more than 24), then you can use this command.
  • using this page switch, you can see the contents of directory in group of twenty three files.
  • after the first twenty three files have been displayed, computer prompt appears asking you to press any key to see next set of twenty three files. In this way, you can see all the files present in the directory
Example 3

C:\>DIR/W
It displays the list of files in a wide format.
In a wide format , five files per line are displayed and other information like file size, date and time of creation are suppressed.

Example 4
C:\>DIR/ah
This command displays all file names in the current directory (i.e. C:\>) which are normally hidden (with the h attribute).


.
  

No comments:

Post a Comment