Arjun Singh
Arjun Singh

Reputation: 43

How do I store a list of files into a text file?

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.

Upvotes: 1

Views: 154

Answers (2)

PA.
PA.

Reputation: 29339

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

Upvotes: 0

Thomas
Thomas

Reputation: 181745

dir /b *.xml > xmlfiles.txt

Upvotes: 1

Related Questions