passing multiple strings to get path but no results in PowerShell -
i have following codes:
filter multiselect-string( [string[]]$patterns ) { # check current item against patterns. foreach($pattern in $patterns) { # if 1 of patterns not match, skip item. $matched = @($_ | select-string -pattern $pattern) if(-not $matched) { return } } # if patterns matched, pass item through. $_ } get-childitem -recurse | multiselect-string 'v1','produit','quota'| select -unique path
when execute code should give me path + name of file (directory/filename)
however gives me no results, when executed same without |select -unique path
it gives me results useless me. how directory path , file name. idea ?
path
not properties fileinfo object
. use directory
or fullname
instead:
get-childitem -recurse | multiselect-string 'v1','produit','quota'| select -unique directory # path or fullname path\filenamt.ext
Comments
Post a Comment