How to find all the *.txt files in any directory(i.e. c:\,d:\ etc.) through command prompt?
Although it will only search subdirectories, so you'd need to `cd` to the root directory. I also don't know of a way to get it search all drives (i.e. if you're in C:\, it won't search D:\ automatically)
Simon Nickerson
2010-04-23 09:50:41
+1 @Simon. Thanks for pointing that out.
Marcelo Cantos
2010-04-23 11:13:58
Oops, somehow I thought he wanted a command which he would run in that particular directory... :|
Mr Roys
2010-04-23 09:49:04
+1
A:
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
S.Mark
2010-04-23 09:37:39
A:
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
Anders
2010-04-23 13:39:34