Created
March 20, 2011 21:16
-
-
Save pal/878688 to your computer and use it in GitHub Desktop.
All-in-one script for organizing my massive amount of images. Still not stream-lined for images sans EXIF data and movies.
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
#!/bin/sh | |
# Complete script for organizing pictures and removing duplicates | |
# Setup some constants | |
SRC_DIR=${1:-"$HOME/Pictures"} # defaults to "$HOME/Pictures" or file argument | |
DEST_DIR="$HOME/Backuped/originals/pictures" | |
# use exiftool to organize all pictures, yay! | |
# http://www.sno.phy.queensu.ca/~phil/exiftool/ | |
exiftool -r -d "$DEST_DIR/%Y/%m/%d/%Y-%m-%d_%H.%M.%S%%-c.%%e" "-filename<datetimeoriginal" $SRC_DIR | |
temp_file="/tmp/fl$$" # $$ is process ID | |
find "$DEST_DIR" -type f -exec shasum {} \; | sort -r > $temp_file | |
# use substr($0, index($0, " ")); instead of $2 to handle filenames with spaces | |
awk 'a[$1]++ {gsub(/^\*/,"",$2); print "rm ", substr($0, index($0, " "));}' $temp_file | sh | |
exiftool -r "-DateTimeOriginal>FileModifyDate" "$DEST_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment