tags:

views:

47

answers:

2

I want to create a batch file which will parse through a given directory and get me all XML files.

These XML file names are to be stored in a text file.

+1  A: 
dir /b *.xml > xmlfiles.txt
Thomas
Say my directory is at C:\www\ folder where do i specify the directory and also the xml files will be in sub folders too
Arjun Singh
dir /b *.xml > xmlfiles.txtthis gives me the file name along with the path but i dont need the path to be stored only the file name
Arjun Singh
Try `dir /?`. It'll tell you all you need to know.
Thomas
A: 

try the FOR command. Read the usage information first, try HELP FOR. Then, experiment with this examples:

FOR %%a in (*.xml) DO ECHO %%a >>xmllist.txt 

or

FOR /R %%a in (*.xml) DO ECHO %%a >>xmllist.txt

or

FOR /R %%a in (*.xml) DO ECHO %%~na >>xmllist.txt

and choose what fits better with your requirements

PA
The last two are identical.
Joey
you are right, thanks. I have corrected it.
PA
thanks PA this was very helpful.
Arjun Singh