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'm trying to get a list of all the XSL and XSLT files in a directory.

dir -recurse -filter *.xsl,*.xslt -name

But the following error:

Get-ChildItem : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Filter'. Specified method is not supported.

dir -recurse -filter *.xsl -filter *.xslt -name

But got this error:

Get-ChildItem : Cannot bind parameter because parameter 'Filter' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".

Can I list both file extensions with a single command?

share|improve this question
up vote 22 down vote accepted
dir .\* -include ('*.xsl', '*.xslt') -recurse
share|improve this answer
Note that the () is actually redundant, but I prefer to be explicit. – EBGreen Aug 2 '11 at 18:25

I do not know why, but this one seems to be much faster:

dir .\ -recurse | where {$_.extension -in ".xsl",".xslt"}
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.