2014-06-21

Sorting photos after holiday

Introduction

When my wife an I are on vacation, we always take photos using two cameras. One is my own and second belongs to my wife. After holidays we want to have one folder with all the photos sorted by date and time and named in this manner, so we do not have to select sort_by_date each time we want to view them. Of course, date and time on our cameras are synchronized.

Main

Creation date and time could be obtain from photo file using exiftool program from command line:
$ exiftool DSCN6201.JPG
and the output looks like this:
ExifTool Version Number         : 9.13
File Name                       : DSCN6201.JPG
Directory                       : .
File Size                       : 2.8 MB
...
Date/Time Original              : 2013:08:15 08:56:34
Create Date                     : 2013:08:15 08:56:34
...
I have written shell script which using exiftool rename all JPG files in current directory with prefix_yyyy_mm_dd__hh_mm_ss.JPG pattern. I only have to copy script file to photo directory and execute it with given prefix:
$ ls
DSCN6201.JPG  DSCN6203.JPG  DSCN8338.JPG  DSCN8340.JPG
DSCN6202.JPG  DSCN8337.JPG  DSCN8339.JPG  sorter.sh
$ ./sorter.sh holidays
$ ls
holidays_2013_08_15__08_55_55.JPG  holidays_2013_08_15__08_56_34.JPG
holidays_2013_08_15__08_56_08.JPG  holidays_2013_08_17__08_37_44.JPG
holidays_2013_08_15__08_56_22.JPG  holidays_2013_08_17__08_41_55.JPG
holidays_2013_08_15__08_56_29.JPG  sorter.sh
Script is available here.

Conclusion

Simple shell script can rename all your photos based on their creation date and time.

No comments:

Post a Comment