Skip to content

Instantly share code, notes, and snippets.

@tlc
Created April 17, 2014 17:11
Show Gist options
  • Save tlc/10998726 to your computer and use it in GitHub Desktop.
Save tlc/10998726 to your computer and use it in GitHub Desktop.
delete duplicate image files
# I had a lot of duplicate images of the form
# IMG_NNNN.JPG and IMG_NNNN-001.JPG
# I wanted to delete the -001 versions, but not all -001 files were dupes.
alias sortline='tr " " "\n" | sort | tr "\n" "\t"'
alias getem='fdupes -1 . |while read line; do echo $line |(sortline; echo)| cut -f1 ; done |xargs -r rm '
for l in 2* ; do (cd $l; getem); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment