What's the proper syntax to set a Powershell filter variable based on multiple values? -
i have powershell script processes files in directory based on selection criteria. 1 run, need act on html files, i'm using following code.
$bkppath = "\\filepath" $selectionfilter = "*.htm*" $srcfiles = get-childitem $bkppath -filter $selectionfilter foreach($doc in $srcfiles) { do-stuff }
for run, need act on that's not related to html in directory, want exclude *.htm*
, *.js
, *.ico
, *.xml
. i've not been able find proper syntax applying multiple values selectionfilter
variable.
i need this:
$selectionfilter = !("*.htm*" or ".js" or "*.xml" or "*.ico")
or
$srcfiles = get-childitem $bkppath -filter !("*.htm*" or ".js" or "*.xml" or "*.ico")
both of give me syntax error.
i've not been able find on msdn covers how handle multiple values this. can please point me in right direction?
while -exclude *.ico, *.js, *xml
correct syntax exclusion, important caveat pathname exclusion applied must end \*
in order work. -filter
not have requirement; , that's getting messed up.
$srcfiles = get-childitem $bkppath\* -exclude *.htm*, *.js, *.xml, *.ico
proper syntax in example.
Comments
Post a Comment