Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.