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.

I need to list all files that have first char within a specific range.

If I use Powershell I can do this with

gci [a-c]*

How can I do it from command line?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You may use the following command:

dir /b | findstr /R "^[a-c].*"
share|improve this answer
    
Thank you very much. It's perfect. :) I can use even different ranges. ^[a-c|e-h].*". Thanks again. –  nick rulez May 22 '11 at 11:47
    
Can you explain me why it's necessary the dot after ]? –  nick rulez May 22 '11 at 11:49
    
This is a regular expression meaning "anything that starts from a-c range followed by zero or more of any characters (the dot)". I'm used to specifying the regular expressions that way, but actually findstr util doesn't require using the full syntax here, so you may omit the dot and the asterisk. –  Jack Shainsky May 22 '11 at 21:00
    
Thanks again for the explanation. :) –  nick rulez May 23 '11 at 18:28

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.