0

I am trying to list all the files with a specific extension but not the current directory.

Something like this

dir "C:\x y\test\" /b /s *.txt

but instead of the expected result it lists all the files from the specified directory AND the ones from the current directory.

Is there a way to get list the files with a specific extension from another directory than the current one

Mark
  • 3,609
  • 1
  • 22
  • 33
Dan
  • 683
  • 2
  • 8
  • 24
  • Go to [this](http://stackoverflow.com/questions/2423935/windows-command-line-search-for-exact-extension-with-dir), I think its a possible duplicate –  Mar 05 '14 at 13:41

3 Answers3

1

I'm not really sure, but i think it would be

dir "C:\some\path\*.txt" /b /s /a-d
foxidrive
  • 40,353
  • 10
  • 53
  • 68
Mike S.
  • 1,995
  • 13
  • 25
0

Do you look for something like

dir "c:\temp\*.txt"

As a fact I am not in c:\temp.

wumpz
  • 8,257
  • 3
  • 30
  • 25
0

How about FORFILES? It's more robust than the old "dir":

FORFILES /P "Your/Path" /S /M *.txt

*/p = The Path to search */s = Recurse into sub-folders

the_marcelo_r
  • 1,847
  • 22
  • 35