This article details how to create a plain text directory listing on Windows, using the Windows command prompt. To open a Windows command prompt in Windows 10, simply type “cmd” in the Windows search bar.
Once the Command Prompt is open, use the ‘cd’ command to change to the directory you want to get a directory listing of. I like to first copy the target system path and then type cd, then space, then right click to paste the path. For example:
cd C:\Users\Chris\Desktop\Meteor\meteor-list-app
Once you are at the correct system path, you can type ‘dir’ in order to see a directory listing.
C:\Users\Chris\Desktop\Meteor\meteor-list-app>dir
For example:
Now to make a .txt directory listing, use the command dir > name_of_file.txt
For example:
dir > meteor_dir.txt
This creates a “meteor_dir.txt” file inside the target directory. For example:
When opened, this directory listing looks just like what was shown in the cmd window:
Note: Instead of just providing the name of the file as an argument, we could provide a full system path to some other location where we want to save the file. For example:
dir > C:\some\folder\name_of_file.txt
Alternatively, if we want a more thorough directory listing, we could use:
dir /S /O:D > meteor_dir2.txt
This will iterate through every sub-folder as well as give dates and times for every file, so the output will be much larger. For example:
/S means include all sub-folders
/O:D means sort by date and time
In summary:
1. cd to the folder you want to capture
2. type dir >name_of_file.txt (or alternative command)
3. hit Enter