Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking to grab a list of the directories into a text document using a .bat file or the command line.

The problem I'm facing is that I have roughly twelve hard drives with a few folders in it, then inside those directories are around 163 more folders and I have to catalog them all. Doing this by hand would be a huge task and I'm looking to simplify it.

If you need any more information please just ask and I will provide it.

share|improve this question

migrated from stackoverflow.com Apr 4 '13 at 21:32

This question came from our site for professional and enthusiast programmers.

    
do you simply want to list the directories, or all the files in the directories? –  Peter Wright Apr 4 '13 at 18:11
2  
"dir/s" lists everything in every directory. "dir/AD" lists directories only. "tree" lists subdirectories. –  FoggyDay Apr 4 '13 at 18:14
    
Just the directories, as the folders contain video files and assets, I just need to know the 'project'(folder) name –  azrael Apr 4 '13 at 18:14
    
Thank you very much FroggyDay, That did the trick. –  azrael Apr 4 '13 at 18:15

3 Answers 3

You can try different params like /s. How you will do in multiple drives is another matter. You'd end up writing a .bat file which loops through different drives and run the command below. Or simply run this from every drive and collate the results.

dir /s > fileNames.txt

The above will create a fileNames.txt with all dir names.

HTH

share|improve this answer
    
+1. In Win Server 2008 R2 64-Bit, this command listed all files not just folders. –  s15199d Jul 18 '13 at 17:52

You want the dir command with the flag /s.

share|improve this answer

Try:

tree C: > out.txt
tree D: >> out.txt
...
tree Z: >> out.txt

You will need to do some editing, but the escape characters do help with the heirarchy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.