Batch file help!!

Solved/Closed
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,

Please some one help me with this...my problem is that i want to create a batch file that can save all the names of sub folders for a given folder into a txt file or csv file

what I mean is for ex if i have a folder "music" which has 200+ sub folders., each folder name being the album's name...I want all these names(folder name only) to be saved in a text file or a csv file.

I wanted to know how to create a batch file for this

3 replies

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Why batch ?

why not run the command

go to command prompt
go to the root folder from where you want to scan
type dir /ad /b /s > myfolderlist.txt
0
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
ONE CORRECTION

dir /ad /b /s > myfolderlist.txt
0
hii


Thanx a bunch rizvisa1.u saved my day.i have a1 tb hardisk and like 600 movies.so i just wanted to keep a log of it.thanks thanks thanks!!!!!

The text file created had the whole path of each folder though.but then it was an easy task- i replaced it with notepad's replace function.thanxxx again.
0
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
You are welcome. If you dont have sub folders within subfolders, but rather have all the folders at one level then you could try thing

go to to the target folder and type
dir /ad /b >myfolderlist.txt

this will create a file that contains all the sub folders at that level (it would not look at the whole tree of folder) and in which case you should have have to use notepad to remove the extra path info
0