Windows command line list all directories

command linewindows

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.

Best Answer

  • 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