Created
June 5, 2015 16:19
-
-
Save quentinproust/8d3bd11562a12446644f to your computer and use it in GitHub Desktop.
Remove duplicate files with powershell
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
ls | Get-FileHash | |
| Group-Object -Property Hash | |
| Where-Object -Property Count -gt 1 | |
| ForEach-Object { $_.Group.Path | select -First ($_.Count -1)} | |
| Remove-Item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment