Sunday, July 20, 2008

Cleaning up photos on Mac OS X

1. A shell scripts to copy just my JPEGs from my $BACKUP_LOCATION to a single unified $FINAL_DESTINATION:


#! /usr/bin/ksh

cd $FINAL_DESTINATION
find $BACKUP_LOCATION -name "*.jpg" | while read line
do
p=$(dirname "$line" )
p1=$(echo $p | sed 's/\///')
echo "$p1"
mkdir -p "$p1"
cd "$p1"
tocopy=$(pwd)
echo $tocopy
cp "$line" "$tocopy"
cd -
done


Source: http://www.unix.com/shell-programming-scripting/65013-find-copy-files-absolute-path.html - I added the extra double quotes (") to make sure it works with paths that contains spaces.

2. Imported all my photos from $FINAL_DESTINATION into iPhoto (under 1 single Library).

3. Currently using: Duplicate Annihilator to eliminate my duplicates -- Yup, I know, I could have written something myself, but then again I have better things to do with my life :-)

1 comments:

Steve said...

<joke>Why don't you just hit the 'it just works' button?</joke> :-P