Last active
February 8, 2019 22:19
-
-
Save alfredmyers/0d96df2dd9388d8256538478b3c7436d to your computer and use it in GitHub Desktop.
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