Updated image renaming script

To help keep track of my photos, I like to rename them so their filenames are based on the date and time they were taken. I’ve used a couple of different scripts to do this, settling on a single-line bash script that runs exiftool. This works really well, but sometimes the extensions on my photos are jpg and sometimes they’re JPG. So, I added a couple of lines to the renaming script to first lowercase the extensions. Here’s the new script:


#!/bin/bash
ls -l *.JPG > /dev/null 2>&1
if [ "$?" = "0" ]; then
for f in *.JPG
do
mv "$f" "${f%.JPG}.jpg"
done
fi
ls -l *.jpg > /dev/null 2>&1
if [ "$?" = "0" ]; then
exiftool -d %Y%m%d_%H%M%S%%-c.%%e "-filename<CreateDate" *.jpg
fi

Download camcon:camcon.zip

Bookmark the permalink. Share on Twitter or Facebook.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>