Sometimes I have a batch of files in a Windows Directory and I want to either print a list of what I've got to a file, or copy data into Excel or similar to do some more complex analysis. If I want to do something more complex than simply taking a screenshot of the directory, I do this using DOS, the granddaddy of Microsoft systems.(Then I don't need to do this for some time, and next time I have to go looking for my notes. No longer! I'll be able to find them on this site!)
The following ought to work on any Windows system up to Windows 8 (I've yet to try Windows 8 so don't know what would happen there).
When the directory is on C:
- Click the Start button in Windows (bottom left corner of windows toolbar, the button that is now the 4-coloured Microsoft flag, but used to be a button called Start in earlier versions of Windows)
- The start menu opens - In the “Search programs and files” box, type CMD
- This opens cmd.exe, (a black window with white text)
- Have a note of the file path to the folder you want. Lets say you want to print a list of what you have in your downloads folder (C:\users\chris\downloads in my case)
- The black window has a prompt (probably C:\users\chris) telling you which directory it is currently pointing to. You need to get it to point to a different directory within C: So you type "CD \users\chris\downloads" (or the name of the directory you want to reach)
- DOS replies "CD \users\chris\downloads" (or the name of the directory you want to reach), and you type dir>listing.txt (or another filename if you don't like "listing")
- If you navigate to \users\chris\downloads, you will now find your text file listing.txt, which you can print or import into Word or Excel etc for further fun
Here's what the DOS box will look like when you've reached step 6:
Here's a version of that screenshot in which I've boxed in yellow text which I typed (as opposed to what DOS "replied"):
When the directory is on another drive, e.g. V: or G:
Sometimes you want to get a listing of files that are not on your C: drive (you are on a network, or the files are on a portable drive). Let's say you want a listing of "G:\packaging script output tars20120719"
The process is the same as the above except that you need to get DOS to point at a different drive
- Click the Start button in Windows (bottom left corner of windows toolbar, the button that is now the 4-coloured Microsoft flag, but used to be a button called Start in earlier versions of Windows)
- The start menu opens - In the “Search programs and files” box, type CMD
- This opens cmd.exe, (a black window with white text)
- Have a note of the file path to the folder you want. "G:\packaging script output tars20120719"
- The black window has a prompt (in my case C:\users\chris) telling you which directory it is currently pointing to. You need to get it to point to a different DRIVE this time. So instead of typing CD \..., you type "CD /DG:\packaging script output tars20120719". The "/D" command tells DOS that you want to change drive
- DOS replies G:\packaging script output tars20120719 (or the name of the directory you want to reach), and you type dir>listing.txt (or another filename if you don't like "listing")
- If you navigate to G:\packaging script output tars20120719, you will now find your text file listing.txt, which you can print or import into Word or Excel etc for further fun.
Here's what it looks like (note that my first go at reaching G: did not work because I "forgot" to add the "/D" command. DOS stubbornly gives you a prompt that is the original directory again and leaves you to figure out what you did wrong. Ah, computing in the 80's!):
And here is a version of that screenshot where I've highlighted in yellow things I typed myself:
What the txt file looks like
Here is what I get in my listings.txt file - you can see I get the modification date and time, file size and file name ("data.2012-06-18.tar" etc). The listing also tells me the number of files and their total size:
my txt file reads:
Volume in drive G is Expansion Drive
Volume Serial Number is 1CDC-DAB8
Directory of G:\packaging script output tars20120719
08/11/2012 13:39 <DIR> .
08/11/2012 13:39 <DIR> ..
18/06/2012 03:23 363,796,480 data.2012-06-18.tar
19/06/2012 03:09 105,881,600 data.2012-06-19.tar
20/06/2012 05:55 3,205,591,040 data.2012-06-20.tar
21/06/2012 03:47 483,563,520 data.2012-06-21.tar
22/06/2012 03:16 196,956,160 data.2012-06-22.tar
25/06/2012 03:17 238,018,560 data.2012-06-25.tar
26/06/2012 03:15 216,565,760 data.2012-06-26.tar
27/06/2012 03:03 27,166,720 data.2012-06-27.tar
28/06/2012 05:15 2,556,620,800 data.2012-06-28.tar
29/06/2012 03:04 65,392,640 data.2012-06-29.tar
02/07/2012 03:09 91,504,640 data.2012-07-02.tar
03/07/2012 03:17 228,884,480 data.2012-07-03.tar
04/07/2012 03:28 511,948,800 data.2012-07-04.tar
05/07/2012 04:12 1,353,256,960 data.2012-07-05.tar
06/07/2012 03:08 111,656,960 data.2012-07-06.tar
09/07/2012 03:53 942,039,040 data.2012-07-09.tar
10/07/2012 03:23 388,392,960 data.2012-07-10.tar
11/07/2012 03:17 249,477,120 data.2012-07-11.tar
12/07/2012 03:28 518,000,640 data.2012-07-12.tar
13/07/2012 03:06 72,632,320 data.2012-07-13.tar
16/07/2012 03:39 679,424,000 data.2012-07-16.tar
17/07/2012 03:20 358,225,920 data.2012-07-17.tar
18/07/2012 03:17 275,865,600 data.2012-07-18.tar
19/07/2012 03:28 424,181,760 data.2012-07-19.tar
08/11/2012 13:39 0 tarlist.txt
11/10/2012 16:58 <DIR> temp unpacked
25 File(s) 13,665,044,480 bytes
3 Dir(s) 144,890,527,744 bytes free
Recent Comments