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.

link|improve this question
feedback

1 Answer

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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