Smart rename for photo image files (jhead)
If you have digital camera then you also have lots of digital photos on your disk drive. For you who want to better organise your photos here is one quick tip.
Cameras name photo files in non human friendly ways, for example last few photos I took have these filenames:
$ ls
pa198126.jpg pa198130.jpg pa198134.jpg pa198138.jpg pa198142.jpg pa198146.jpg pa198150.jpg pa198127.jpg pa198131.jpg pa198135.jpg pa198139.jpg pa198143.jpg pa198147.jpg pa198151.jpg pa198128.jpg pa198132.jpg pa198136.jpg pa198140.jpg pa198144.jpg pa198148.jpg pa198129.jpg pa198133.jpg pa198137.jpg pa198141.jpg pa198145.jpg
Just from looking at the file names and not oppening these photos you can't really get much information. If you wish to smartly bulk rename your photo files so that the file names have more meaning continue reading.
First we need to install jhead. If you are using Fedora use yum for installing jhead and for Debian (Ubuntu) based systems use apt-get:
yum install jhead
or
apt-get install jhead
To give these images a new name we will use date written by the camera to their exif tags. Exif tags contain a lot of useful information like date and time the shoots were taken, brand and model of the camera, shutter speed and other info.
We will use only the time info for now, but you can play with all the settings as you wish.
To rename the images with date and time when they were shoot we can use jhead with these parameters:
jhead -n%Y_%m_%d_%H%M%S IMG*.jpg
After that we have a much more human friendly image names:
$ ls
2008_10_19_161728a.jpg 2008_10_19_162047.jpg 2008_10_19_172113.jpg 2008_10_19_173315.jpg 2008_10_19_161728.jpg 2008_10_19_162100.jpg 2008_10_19_172124.jpg 2008_10_19_173330.jpg 2008_10_19_161830.jpg 2008_10_19_162204.jpg 2008_10_19_172137.jpg 2008_10_19_173349.jpg 2008_10_19_161840.jpg 2008_10_19_162218.jpg 2008_10_19_172141.jpg 2008_10_19_173806.jpg 2008_10_19_161949.jpg 2008_10_19_171956.jpg 2008_10_19_172231.jpg 2008_10_19_173816.jpg 2008_10_19_162000.jpg 2008_10_19_172009.jpg 2008_10_19_173256.jpg 2008_10_19_162034.jpg
If you have some more examples how this approach can be enhanced even more please post it in the comments.
UPDATE:
I read a great article on linux.com about automated image processing. Highly recommended.