Sunday 8 January 2017

metadata - How to use exiftool to write date tags according to file path?


I need to set the exif date tag of a bunch of photos stored with the following hierarchy: YEAR/MONTH/DAY/IMG_something.JPG


How could I do it easily with exiftool?




Answer



Basically, the command would be something like this
ExifTool "-TAG
assuming that the directory structure is numeric e.g. 2015/07/04
But there may be problems depending upon the exact tag you want to use. Many date/time tags require a time as well as a date and I believe all the EXIF date/time tags fall into this category. If you don't care about the actual time, you could -TAG<$Directory 00:00:00. Or if you want to increment the time, you can see this previous post for some help.


XMP tags are usually more flexible and can be used without a time.


If there is already a current time in the tag and you just want to change the date, you can use something like this
ExifTool "-DateTimeOriginal<$Directory ${DateTimeOriginal;s/.* //"


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...