Let's say I have a bunch of photos, all with correct EXIF information, and the photos are randomly named (because of a problem I had). I have a little program called jhead which gives me the below output:$ jhead IMG_9563.JPGFile name    : IMG_9563.JPGFile size    : 638908 bytesFile date    : 2011:02:03 20:25:09Camera make  : CanonCamera model : Canon PowerShot SX210 ISDate/Time    : 2011:02:03 20:20:24Resolution   : 1500 x 2000Flash used   : Yes (manual)Focal length :  5.0mm  (35mm equivalent: 29mm)CCD width    : 6.17mmExposure time: 0.0080 s  (1/125)Aperture     : f/3.1Focus dist.  : 0.29mISO equiv.   : 125Exposure bias: -1.67Whitebalance : ManualLight Source : DaylightMetering Mode: patternExposure Mode: ManualNow I need to rename all the photos in the folder in the next format:001.JPG002.JPG003.JPG...Where the minor number would be the older image, and the maximum the newer.I'm not so good scripting, so I'm asking for help.I think a bash script is enough, but if you feel more comfortable, you can write a python script. I thought in something like:$ mv IMG_9563.JPG `jhead IMG_9563.JPG | grep date`but I don't know how to do that for all the files at once.
How can I rename photos, given the EXIF data?
bash;rename;python;exif
You can to it for all files using a for loop (in the shell/in a shell-script):for i in *.JPG; do  j=`jhead $i | grep date | sed 's/^File date[^:]\+: \(.\+\)$/\1/'`.jpg  echo mv -i $i $jdoneThis is just a very basic outline. Delete echo when you have verified that everything works as expected.