List only files of a particular extension with the DIR command

92,662

Solution 1

Dir supports wildcards, so:

dir *.txt

Solution 2

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 .

Solution 3

dir /S *.txt 

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

Share:
92,662

Related videos on Youtube

Johnydep
Author by

Johnydep

Updated on September 18, 2022

Comments

  • Johnydep
    Johnydep almost 2 years

    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?

  • sean christe
    sean christe over 12 years
    It does quite a bit more also, try...Dir /?
  • Johnydep
    Johnydep over 12 years
    i tried but it did not show me * option, rest i know.
  • user419144
    user419144 over 5 years
    This doesn't quite what the OP wants, see stackoverflow.com/questions/2423935