Categories
General

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

Avatar photo

By isaac

I like cats. he/him