22

On Windows, we can see directory content using the DIR command.

I want to know, how can one see the list of only those files which have particular extension, e.g I want to see list of all .txt files, what command I should run?

3 Answers 3

28

Dir supports wildcards, so:

dir *.txt
3
  • It does quite a bit more also, try...Dir /?
    – EBGreen
    Commented Jan 26, 2012 at 15:19
  • i tried but it did not show me * option, rest i know.
    – Johnydep
    Commented Jan 26, 2012 at 15:29
  • This doesn't quite what the OP wants, see stackoverflow.com/questions/2423935
    – user419144
    Commented Nov 11, 2018 at 10:31
8

You can list only the filenames without the extra information added with the command
dir /b *.[extension].

A more comprehensive list can be found here .

7
dir /S *.txt 

will show files with ".txt" suffix in specified directory and all sub-directories.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .