It took me some time to find a way for me to store and manage all my RAW photos. With thousands of new photos taken every year I had to come up with a solution that could replace my local storage.


My requirements:

  • All files should be converted to DNG
  • All files must be timestamped with year, month, day and time
  • All files should contain a unique identifier
  • The cloud storage service should not be to expensive
  • The cloud storage service should support Video and other files as well
  • It should be possible to automate import, conversion and upload
  • It must support Mac OS-X

The solution

Software:

  • exiftool to extract the following EXIF data:
    • Original date and time of photo
    • Unique document ID
  • Adobe DNG Converter
  • Shell script to import, extract EXIF info, rename file and store locally.
  • Amazon Drive for Mac to sync with cloud

Cloud service

Bonus

The iPhone/Android app Amazon Prime Photos allows all mobile devices to sync their photos into Amazon Drive. In addition there is a nice web-interface that allows me to browse all stored photos and videos. The service also support easy sharing with others.

TODO:

  • Automatically start the Amazon Drive software to sync new photos.

The import.sh script

You will need to install exiftool and Adobe DNG Converter to run this script.

#!/bin/sh

SOURCE=/Volumes/EOS_DIGITAL/DCIM/100EOS5D
TARGET=/Volumes/Pegasus/Photos/photo-import
ARCHIVE=/Volumes/Pegasus/Photos/Archive
mkdir -p $TARGET

echo "Converting RAW images to DNG"
/Applications/Adobe\ DNG\ Converter.app/Contents/MacOS/Adobe\ DNG\ Converter -d $TARGET/ $SOURCE/*.CR2

FILES=`ls $TARGET/*.dng`

for FILE in $FILES; do
	DATE=`exiftool $FILE | grep "Date/Time Original" | tail -n 1 | awk '{ print $4 "-" $5 }' | sed 's/:/-/g' | sed 's/\./-/g'`
	ID=`exiftool "$FILE" | grep "Original Document ID" | awk '{ print $6 }'`
	if [ "$ID" == "" ]; then
		ID=`md5 "$FILE" | awk '{ print $4 }' | tr [:lower:] [:upper:]`
	fi
	COM=`echo "$ID $FILE" | tail -n 1 | awk '{ print $1 }'`
	SUBFOLDER=`echo "$DATE" | sed 's/-/ /g' | awk '{ print $1 "/" $2 }'`
	ARCHIVE_TARGET="$ARCHIVE/$SUBFOLDER/$DATE-$COM.dng"
	mkdir -p "$ARCHIVE/$SUBFOLDER"
	mv -v "$FILE" "$ARCHIVE_TARGET"
done

rmdir "$TARGET"

# TODO: start Amazon Drive sync

exit 0