I am trying to list out the files except any directory which contains the array elements.
i.e The file paths which matches any values of the array should be skipped.
The below is my code. But its returning file paths including the items in the array. It should not.
Could anyone suggest how to skip the files which contain array strings anywhere in the path.
$skipitems = @('params','workers') $srcpath = 'D:\dinesh\myproject' $parent_items = Get-ChildItem -Path $srcpath -Recurse | Where-Object {!$_.PSIsContainer -and $_.Extension -ne '.exe'} ForEach($parent_item in $parent_items){ #If($skipitems -notmatch parent_item.FullName){ If($skipitems | Where-Object{(split-path $parent_item.FullName -parent) -notmatch $_}){ Write-Host $parent_item.Fullname } }
Thanks
Dinesh