Skip to content

Instantly share code, notes, and snippets.

@misteroneill
Created February 24, 2013 22:52
Show Gist options
  • Save misteroneill/5026108 to your computer and use it in GitHub Desktop.
Save misteroneill/5026108 to your computer and use it in GitHub Desktop.
Use this script to quickly clean up duplicate iPhone images, which are named like this: "IMG_1234 1.JPG" where this is a copy of "IMG_1234.JPG", though it can take any pattern that will work with the `-name` argument of `find`. These files are sometimes the by-product of importing iPhone pictures via the Image Capture application. This script MU…
#!/bin/bash
#
# Use this script to quickly clean up duplicate iPhone images, which are named
# like this: "IMG_1234 1.JPG" where this is a copy of "IMG_1234.JPG", though
# it can take any pattern that will work with the `-name` argument of `find`.
#
# These files are sometimes the by-product of importing iPhone pictures via the
# Image Capture application.
#
# This script MUST be in the same directory as your photos! I did not add the
# ability for a custom directory because this is sufficient for my purposes (it
# just sits in my `~/Dropbox/Photos/iPhone` directory).
cd $(dirname ${BASH_SOURCE[0]} && pwd)
pattern="IMG_* *.*"
if [ "$1" != "" ]; then
pattern="$1"
fi
find . -type f -name "$pattern" -print0 | xargs -0 rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment