user3566591
user3566591

Reputation: 165

CMD DOS Running DIR command in order to find a specific file extension

I would like to list only XML files from the folder "C:\Test\Path" and save the results to a text file.

However, the following command lists all files from the folder and not only the XML files:

cmd /c dir "C:\Test\Path" /s /b *.xml> c:\Test\RunDIROnXMLFolder11.txt

Upvotes: 1

Views: 1807

Answers (2)

Stephan
Stephan

Reputation: 56180

the proper syntax is:

cmd /c dir /s /b "C:\Test\Path\*.xml" > c:\Test\RunDIROnXMLFolder11.txt

(/s and /b may be before or after the filespecification, but this should be

<drive>:\<path>\<filespec>

Upvotes: 1

Tak
Tak

Reputation: 1562

Try ..

cmd /c dir /s /B "C:\Test\Path\*.xml" > c:\Test\RunDIROnXMLFolder11.txt

Upvotes: 0

Related Questions