Canon Eos digital cameras name their files “img_XXXX.jpg” where ‘XXXX’ is a number beween 0001 and 9999. Considering how many pictures we take, duplicate names come fast. In addition, that name is desperately lacking any meta-information that may help in making the file manageable.

So as part of my workflow I have defined a photo file naming scheme that includes the date, the time and the session that picture belongs to. What I define as a session is a group of pictures with a unity of time, place and/or action. I believe I have found a good choice of minimal meta-information to pack in the file name to make it both unique and useful to humans.

The datetime of acquisition is found in an EXIF tag embedded in the file. I deduce the session from the parent directory name because putting all pictures belonging to a single session into an approprietely named directory is what immediately follows my automated download and lossless rotation routine.

Because I am a very lazy person I have of course automated all that. So here is dir_date_serial_rename_all.sh – a small shell scripts that automates my habit of picture files renaming.

This script takes all files in the current directory and renames them using the following pattern :
current_directory_name.date.time.camera_serial.extension

For example :
"my current directory/img_6051.jpg" taken the 2nd of December 2005 at 9:07:59 AM (according to the embedded EXIF metadata)
becomes
my current directory/my_current_directory.20051202.090759.6051.jpg