Reputation: 53
How to find all the *.txt files in any directory(i.e. c:\,d:\ etc.) through command prompt?
Upvotes: 1
Views: 233
Reputation: 101666
setlocal ENABLEEXTENSIONS
FOR %%A IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO @call :dumpdrive %%A
echo Done...
goto :EOF
:dumpdrive
FOR /R "%1:\" %%B IN (*.txt) DO @echo.%%~fB
goto :EOF
Upvotes: 0
Reputation: 123841
Following will search from root directory and its all accessible sub folders regardless of the folder you currently in.
dir \*.txt /s
or
dir c:\*.txt /s
dir d:\*.txt /s
etc
Upvotes: 1