Here is everything you should now to use DIR command
In this article you will find out:
- what DIR command does
- how to protect your data
Are you ready? Let's read!
What DIR command does?
The command DIR can work separately, in which case you can list the files and folders in the current directory. However, this command can become multifunctional if you know how to use the various switches or parameters associated with the DIR command.
The command, in this case, will look like this: "dir /letter" (without quotes), while the letter code after the DIR command may be different. For example:
- D: Displays all directories in the current path.
- R: Displays read-only files.
- H: Shows hidden files.
- S: Shows only system files.
- I: Shows files without indexing content.
- A: Shows files ready to be archived.
- L: Displays reparse points.
In addition, you can also combine these codes. For example, if you want to show only system files that can be opened as read-only, you can use the following command:
You can also add a "-" character in front of any of the letter codes. This will indicate that the DIR command does not display this type of file. For example, a command like this:
You can also use the ":" character to separate the switch from additional codes, such as
The following are helpful tips for optimizing the DIR command:
1. If you use the /b switch with the DIR command, it will remove all unnecessary information (file size and timestamps, etc.), displaying only the names of folders and files in the current directory. Command is as follows:
2. A switch /D is used for displaying results in two columns instead of one displaying only the files and directory names:
3. Use settings /L to show all files and folder names in the lower case:
4. A switch /N - to use the display of the filename results in the far right corner. You can now use it in conjunction with the "-" sign to display the filenames at the far left instead:
5. Use the /O switch followed by a letter code to display directory results sorted by your query. These letter codes can be:
- D: Sorted by date.
- E: Sorted in alphabetical order.
- G: Sorted first by folder and then by file.
- N: Sorted by filename in alphabetical order.
- S: Sorted by file size.
For example, with the dir /OE command, you can sort the results alphabetically. You can also add "-" before any of the above sorting options to change the order.
6. You can use the /P switch to display the results one page at a time. In such a case, the command line pauses the results after each screen is displayed, then you must press a key to continue viewing the next page of results:
7. Using the /Q switch in the DIR command is necessary to render metadata associated with files and directories and owner information:
8. Use of the /R option is required to display alternate data streams (ADS):
9. You can use the /S switch to display all files and folders that are in the current directory (usually, there are many results):
10. Using the /T switch with an alphabetic code is necessary to display the results sorted by time. The letter codes can be as follows:
- C: the time the item was created.
- W: the time the item was last written (default).
- A: the time interval of the last access to the item.
An example of use: dir /TA , which will display results, sorted by the different time stamps according to the time the item was last written to.
11. You can use the /X option to display short filenames:
12. Using /? switch, you will be able to display the help pages for DIR, which contains a short description of all the switches that were written about here.
It should be some real examples to better understand how these parameters can be used. To display all system files within your current path using the "s" attribute, enter the following:
If you need to view all files of a certain type in all subsequent folders of your current path, run this extremely quick and useful command:
directory \*.mp4 /s
You can replace the ".mp4" part with any file format.
To enable you to read all the results before they scroll off the screen, use the pause switch:
directory \*.mp4 /s /p
Hope these detailed instructions and illustrative examples helped you understand the dir command.
Protect your data!
DiskInternals Partition Recovery is a great free way to open files as a file explorer in the Reader mode. If you need more and want to recover lost/damaged folders and files and export this data afterward, use full recovery mode and forget about this problem forever.
DiskInternals Partition Recovery is a professional application with thousands of positive results and many years of experience. The great news is that you can create a disc image at no cost using this unparalleled software - with such a tool, you will be prepared for any disruption or breakdown of your computer, no doubt.
Download it, and you will see how succinctly it is designed with many basic and advanced features without any cost or pitfalls. You can purchase a license so that you will be able to export data to any source of information using the data Export Wizard, and you can also get additional assistance, if necessary, from the company's technical support specialists for a year after purchasing the license.
Thus, you can find out and clarify any information that interests you, and if any difficulties arise, just trust the experience of professionals! You should succeed; it cannot be otherwise!