DOS file listing

Wednesday, December 9, 2015 at 09:39:50

Need to get a plain and simple file listing from the command line in DOS to pipe in to a programme??

As ever a good starting point is to get help for the command. So:

dir /?

If you peruse through this you’ll eventually work out that this is the command you want:

dir /a-d /b > ..\list.txt

The “>” symbol sends the output and stores it in a file. Make sure to specify “.." before the filename so the file is saved in the directory above the existing one otherwise that file will be listed as well. And if you want to sort on (for example) filename then you add the “\on” switch:

dir /a-d /b /on > ....\list.txt

This will now save me looking that command up everytime!

Add comment

Fill out the form below to add your own comments