Page 1 of 1

Save a list of files and subfolders

Posted: 25 Jul 2011 20:35
by Maheshp
Hi

i am looking for batch file which will retrive all the information from folder & subfolder & save the data on excel file
like f:\ >f:\filename.txt but this syntax don't work for sub folders
i will appreciate any help on this
e.g below should be output once i execute batch.
C:\Users\Desktop\Temp\TXT\sample sheet.xls
C:\Users\Desktop\Temp\sample1 sheet.xls

Re: Save a list of files and subfolders

Posted: 26 Jul 2011 08:14
by trebor68
If you only would have a list of the files use the following code:

Code: Select all

dir /s /b TEST\*.txt


The option "/s" for any subfolder and the option "/b" only list the file name.
In the Example is "TEST" a subfolder in this folder and "*.txt" the files.

In your Example:

Code: Select all

DIR /s /b C:\Users\Desktop\Temp\*.xls

Re: Save a list of files and subfolders

Posted: 26 Jul 2011 10:53
by Maheshp
Hi Trebor68
Thank you so much for help ! :D