Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example if the dir command produces something like this:

> dir
file1.txt
file2.txt
another file3.txt
another file4.txt

I want to be able to filter all file names that start with the letter 'f'. Any ideas?

I've tried the following command but that returns ALL file names with an 'f' anywhere in the name:

>dir | find "f"
file1.txt
file2.txt
another file3.txt
another file4.txt

Unless I've missed something, the documentation here doesn't say how to do this.

share|improve this question
up vote 1 down vote accepted

The documentation says:

You cannot use wildcards (that is, * and ?) in file names or extensions that you specify with the find command

Try using findstr instead:

dir /B | findstr /b "s"
  • I'm using dir with the /B option because I want the Bare format (no heading, file sizes or summary)
  • findstr /b Matches the pattern if at the beginning of a line
share|improve this answer

You must log in to answer this question.

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