Created
May 30, 2016 15:30
-
-
Save CodeBrauer/ef1fb6aca639dedb4d016a1925ba111c to your computer and use it in GitHub Desktop.
Delete duplicate files (by filesize)
This file contains hidden or 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
| bye; | |
| # from: http://superuser.com/questions/1081539/delete-files-with-same-size-but-keep-always-one-file | |
| # find the files to keep | |
| find . -type f -printf "%s %p\n" | grep "zip" | sort -n | uniq -d --check-chars=10 > files.txt | |
| # here it goes! | |
| mkdir unique | |
| # move unique files to dir | |
| cat files.txt | awk '{ print $2 }' | xargs mv -t unique | |
| # delete files that are left | |
| rm *.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment