Aaah, the command line. After downloading from the camera I wanted to move photos into separate directories based on their date
UPDATE:
Hah! This whole script can be replaced by the following exiftool command
Man, exiftool is a powerful program!
UPDATE: Jan 2010
exiftool works with RAW files too
#!/bin/bash
#This is a somewhat inefficent (calls exiftool many times) script that will put pictures
#into a date based directory structure. The script will use exiftool to read the date the
#picture was taken and then move the picture into an apropriate directory
#Requires bash, exiftool
#Works on Darwin and most probbaly any *nix distribution
shopt -s nullglob #if no file is found the pattern *.jpg will expand to itself, but this prevents that
for file in *.[jJ][pP][gG]
do
date=`exiftool -d "%Y-%m-%d" -s -s -s -DateTimeOriginal "$file"`
year=${date%%-*}
mkdir -p $year/$date
mv $file $year/$date/
done
UPDATE:
Hah! This whole script can be replaced by the following exiftool command
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.JPG
Man, exiftool is a powerful program!
UPDATE: Jan 2010
exiftool works with RAW files too
#!/bin/bash
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.JPG
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.AVI
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.NEF
Comments
Post a Comment