Scott Weinstein
Scott Weinstein

Reputation: 19117

Effective way to filter on multiple wildcards in PowerShell

I'd like to be able to do

gci -filter *.ps1,*.cs,*.sql

but that syntax isn't supported.

Upvotes: 4

Views: 7303

Answers (2)

noam
noam

Reputation: 1983

With v3, can do gci -file "*.ps1","*.txt"

Upvotes: 1

Julien Lebosquain
Julien Lebosquain

Reputation: 41213

Use -Include which takes an array, instead of -Filter. Note that you have to use * as the path when using -Include:

Get-ChildItem * -Include *.ps1,*.cs,*.sql

Upvotes: 8

Related Questions