Windows Operating System provides set of commands to perform certain operation(s) and allows the users to run these commands from Windows Command Prompt. One of such command, which is very Popular is the
DIR command in Windows is used to display the list of files and folders which are in the current directory or in the specified directory.
By entering below command at Windows Command prompt; Windows will display all the files and folders in the current directory.
C:\> dir Volume in drive C is System Volume Serial Number is 1xxx-2xxx Directory of C:\ 2011/04/05 03:05 PM <DIR> . 2011/01/05 03:05 PM <DIR> .. 2010/07/23 10:56 PM 888,712 1.png 2011/04/05 06:02 PM <DIR> Program Files 2011/04/05 11:09 PM <DIR> Personal 2010/07/27 04:05 PM 7,941 notes.txt .... .... 18 File(s) 2,978,728 bytes 26 Dir(s) 49,975,476,224 bytes free
Observe that, the above command displays lot of useful information. Here we can read the results as:
- Displays the files and folders which are available in the current directory.
<DIR>entries are directories and other entries are files.
- Displays the date and time of each file or folder when it was last modified or created.
- For files, you will see the size of the file details also. Size of the file is displayed in bytes.
- You can see count of files and folders are available in the current directory. From above results, showing the directory has 18 File(s) and 26 Dir(s) – Directories.
- You can also see the size in bytes the folder occupied and the disk free size. From above results, it is showing “2,978,728 bytes” is the size of the folder and “49,975,476,224 bytes free” is the overall disk free space.
Have you observed “.” and “..” in the results? What are those? These are the logical directories. These are useful to navigate between the folders. The “.” represents the current directory and “..” represents it’s immediate parent directory. For example, to move out from the folder; you can use “
cd ..” command to move to it’s immediate parent folder.
DIR command, we can also list the files and folders from the specified directory. You need to pass the path of the directory as an argument to the
DIR command. The path can be a relative or fully qualified path. For example, below commands produce the same results; they display the files and folders from the folder “Personal”.
C:\> dir Personal
ORC:\> dir .\Personal
ORC:\> dir C:\Personal
Be on learning path always!