I came across a binary called "nconvert". I copied these to /usr/local/bin. I then created a simple recursive shell script to go through the folder and subfolders and convert any photo that needs converting.
#!/bin/sh
function recursion {
if [ $(find . \( -iname "*jpeg" -or -iname "*jpg" \) -maxdepth 1 -type f | wc -l) -gt 0 ]; then
_fullpath=`pwd`
echo "Processing $_fullpath"
echo "Processing $_fullpath" > $HOME/logs/recursive-autorotate-photos.log
nconvert -jpegtrans exif -overwrite *.jpg
fi
for _item in *; do
if [ -d "$_item" ]; then
(cd "$_item"; recursion)
fi
done
}
if [ ! -z "$1" ]; then
if [ ! -d "$HOME/logs" ]; then
mkdir "$HOME"/logs
fi
echo "" > $HOME/logs/recursive-autorotate-photos.log
cd "$1"
recursion
else
echo "Usage: recursive-autorotate-photos.sh path-here"
fi
sample: # recursive-autorotate-photos.sh "/Volumes/my-external-disk/photos"
take note of the quotes in the path. if there's a space in the path, there you need to enclosed it in double quotes. I always use double quotes now out of habit.