Skip to content

Instantly share code, notes, and snippets.

Last active February 8, 2019 22:19
What would you like to do?
Removes file duplicates based on content's hash
$fork = "C:\Users\Alfred\Desktop\MyBooks" # Directory possibly containing duplicate files
$repo = "C:\Books" # Directory containing master files
$repoHashes = (Get-ChildItem $repo -Recurse -File | Get-FileHash).Hash
Get-ChildItem $fork -Recurse -File |
Where-Object { $repoHashes.Contains(($_ | Get-FileHash).Hash) } |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment