Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I want to look for all .txt files in a folder, which their filename starts with r and is 4 character length or lower (<=4)

What's the query? (in Windows XP)

share|improve this question
I'm guessing that powershell is not allowed since it is homework? – EBGreen May 3 '13 at 17:56

r???.txt will work. The question marks represent each character so it will match all txt files starting with r with up to 4 characters.


get-childitem c:\ -r r*.txt |? {$.GetType().Name -match "File" } |? {$.basename.length -le 5} | %{$}

share|improve this answer

Your Answer


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.