Skip to content

Instantly share code, notes, and snippets.

@thebignet
Created February 22, 2017 20:31
Show Gist options
  • Save thebignet/1ac08ddfa8795d07fcec7599663f1d07 to your computer and use it in GitHub Desktop.
Save thebignet/1ac08ddfa8795d07fcec7599663f1d07 to your computer and use it in GitHub Desktop.
Import photos automatically when drive inserted with Automator
VOLUMES="/Volumes"
OUTPUT="/Volumes/MyVolums/Photos" #Change output
PATH="$PATH:/usr/local/bin/"
OIFS="$IFS"
IFS=$'\n'
for disk in $(ls $VOLUMES); do
# Change disk regexp
if [[ "$disk" =~ .*EOS.* ]]; then
for photo in $(find "$VOLUMES/$disk" -type f); do
year=$(exiftool -d "%Y" -DateTimeOriginal -S -s $photo 2>/dev/null)
if [ "$year" != "" ]; then
month=$(exiftool -d "%m" -DateTimeOriginal -S -s $photo)
day=$(exiftool -d "%d" -DateTimeOriginal -S -s $photo)
dest="$OUTPUT/$year/$month/$day"
mkdir -p $dest
cp $photo $dest
echo "$dest/$(basename $photo)"
fi
done
fi
done
IFS="$OIFS"
@thebignet
Copy link
Author

Import into Lightroom or Darktable year/month/day style directories when drive inserted.
Don't forget to add step to import to Photos afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment