I want to write a script that will delete duplicate files and keep one copy where any of that file's parent directory is called "Final"
in other words, do not delete if none of the same files(files with the same hash)' parent dir is called "Final"
UPDATE
this is what I have so for, not sure how to go from here
ls *.* -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group } | select {$_.Path}
I need to filter out $_.Path that contain the directory "Final"
tried where { $_.Directory -contains "Final"} but didn't work