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.JPG File name : IMG_9563.JPG File size : 638908 bytes File date : 2011:02:03 20:25:09 Camera make : Canon Camera model : Canon PowerShot SX210 IS Date/Time : 2011:02:03 20:20:24 Resolution : 1500 x 2000 Flash used : Yes (manual) Focal length : 5.0mm (35mm equivalent: 29mm) CCD width : 6.17mm Exposure time: 0.0080 s (1/125) Aperture : f/3.1 Focus dist. : 0.29m ISO equiv. : 125 Exposure bias: -1.67 Whitebalance : Manual Light Source : Daylight Metering Mode: pattern Exposure Mode: Manual Now I need to rename all the photos in the folder in the next format:
001.JPG 002.JPG 003.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.
ls *.JPG | wc > renameAnd then I'd have to use a script rename to XXX.JPGwc, I forgot the one to order by name.