this will sound like a bad joke, but apparently geniuses from MS arent capable of making uber complicated -exclude gci parameter work. By “genious” design it only works on files, not on entire path. So how to make it work.
For example how to exclude all files whose path contains “Windows” substring?
naive
gci -exclude "*Windows*" -rec
doesnt work
EDIT: googled/figured out this:
| where {$_.DirectoryName -notmatch ".*abcdef.*" }
If somebody knows better solution please share. If not will close question.
The solution is this:
BTW useful thing for guessing solutions to problems like this is to know what methods the current object has, for that I used Get-Member. Example output: