Last active
June 29, 2017 04:14
-
-
Save macostag/bd94d251263ab7707b64acecf38186ae to your computer and use it in GitHub Desktop.
Find and delete duplicate files.
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
$groupFiles = Get-ChildItem -Filter *.* -Recurse | Get-FileHash -Algorithm SHA1 | Group-Object -Property Hash | |
$groupFiles | Where-Object {$_.count -gt 1} | | |
ForEach-Object { | |
$_.Group | Select-Object -Skip 1 | |
} | Remove-Item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment