Maverick
Maverick

Reputation: 1434

CMD command to get the list of only files not folders

I have around 30K files under various subfolders. I need the cmd command to print the list of all the 30K files and only the filenames not the folders.

Upvotes: 2

Views: 2225

Answers (1)

MC ND
MC ND

Reputation: 70923

edited to include file redirection

>"x:\targetFile.txt" (for /r %a in ("x:\startFolder\*") do @echo %~nxa)

Just a recursive enumeration of the files. For each file found echo to console the name and extension of the file.

Upvotes: 2

Related Questions