Skip to content

Instantly share code, notes, and snippets.

@Sitebase
Last active August 22, 2016 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sitebase/b3dda1480ac91a8786656af096c5b838 to your computer and use it in GitHub Desktop.
Save Sitebase/b3dda1480ac91a8786656af096c5b838 to your computer and use it in GitHub Desktop.
Lightroom post-processing script to publish albums on Dropbox
# Script that can be used a post-processing script in lightroom export dialog
# It will auto move all file to your dropbox and use specific parts of the
# filename to create sub folders
# Example: 201009 - India-DSC_3493.jpg
# will be moved to the EXPORT_ROOT/2010 - India/DSC_3493.jpg
DROPBOX_ROOT=$(cat ~/.dropbox/info.json | python -c 'import sys, json; print json.load(sys.stdin)["personal"]["path"]')
EXPORT_ROOT="$DROPBOX_ROOT/Photos/Albums"
LOGFILE="$EXPORT_ROOT/lightroom-export.log"
for FILE in "$@"
do
DATEPART=`expr "$FILE" : '.*\(20[0-9][0-9]\).* -'`
ALBUMPART=`expr "$FILE" : '.*\-.\(.*\)-.*'`
FILEPART=`expr "$FILE" : '.*-\(.*\)'`
DATETIME=$(date "+%Y/%m/%d %T")
EXPORT_FOLDER="$EXPORT_ROOT/$DATEPART - $ALBUMPART";
mkdir -p "$EXPORT_FOLDER"
mv "$FILE" "$EXPORT_FOLDER/$FILEPART"
echo "[$DATETIME] exported '$FILE' to '$EXPORT_FOLDER'" >> "$LOGFILE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment