Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
Created May 30, 2016 15:30
Show Gist options
  • Save CodeBrauer/ef1fb6aca639dedb4d016a1925ba111c to your computer and use it in GitHub Desktop.
Save CodeBrauer/ef1fb6aca639dedb4d016a1925ba111c to your computer and use it in GitHub Desktop.
Delete duplicate files (by filesize)
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