## Batch file to generate bulk folder name copying into a text file

Asked By 60 points N/A Posted on -

Hi Friends, I need to get the names of the folder in a particular path as a text file. I think creating a batch file (bat file) using dos commands will help. Can any one get me the simple commands that I need to include in that batch file that will generate bulk folder name copying into a text file. Thanks

SHARE
Answered By 20 points N/A #166822

## Batch file to generate bulk folder name copying into a text file

To get a list of folders as a text file. Use the DIR command along with /s option to recursively search the subdirectories.

And don't forget to use also the /b option for the "bare" output to justify the file name. For example, to get a list of folders in your C drive,  dir / s / b c :   * .xls

The only problem with this is that the generated file list will be long file names. The only pure DOS way to it is to get the long name to the environment.