Use exiftool to rename your photos

It's annoying to have a bunch of photos with names such as DSC_wxyz.JPG where wxyz integers... My D60 happens to start from the beginning (that is 0001) when I delete all photos from the memory card. So, you take your photos and when you connect the camera to the PC to download them, you discover that your new DSC_0001.jpg file will overwrite your older DSC_0001.jpg if you have not anticipated the creation of folders for each case/event. Besides, DSC_0001.jpg provides 0 (zero) information about the actual photo.

So, enough of this! I searched a bit and discovered exiftool, a handy Perl script that reads the EXIF information (and several other vendor specific tags from the photos). So, the first thought I made was "what is the EXIF feature/tag that uniquely identifies a photo?". The answer was that a good candidate is the time the photo was taken. So, with a minimal Bash script, I can now rename all those DSC_ useless filenames to something like 20090712214512.jpg, which is the concatenated timestamp of the photo (year + month + day + hour + minutes + seconds). You must be a bit unlucky (and have a modern camera) to have two or more photos with the same timestamp (taken at the same second), but with a little tweaking, the script can also be modified to consider this case.

So, the following command will display the EXIF date and time the picture was taken:

$ exiftool -EXIF:DateTimeOriginal DSC_0028.jpg
Date/Time Original              : 2009:01:04 14:18:26

You can now get this timestamp and convert it to a more compact form:

$ exiftool -EXIF:DateTimeOriginal $i|awk '{print $4":"$5}'|tr -d :

This will give you something like


which is good enough for me to uniquely identify my photos.

υπολογιστές / computers: 
Χρήσιμο / Useful: 
No votes yet
Ψηφίστε για την ποιότητα του άρθρου / Vote for the article's quality