Created
February 22, 2017 20:31
-
-
Save thebignet/1ac08ddfa8795d07fcec7599663f1d07 to your computer and use it in GitHub Desktop.
Import photos automatically when drive inserted with Automator
This file contains 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
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Import into Lightroom or Darktable year/month/day style directories when drive inserted.
Don't forget to add step to import to Photos afterwards.