Removes file duplicates based on content's hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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) } | | |
Remove-Item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment