How can I set photo date metadata from a YEAR/MONTH/DAY folder structure using ExifTool?

Asked 8/6/2015

3 views

2 answers

0

I have photos stored in folders like YEAR/MONTH/DAY/IMG_something.JPG (for example 2015/07/04/IMG_1234.JPG). I want to use ExifTool to write the photo’s date metadata based on the folder path. What command should I use, and how do I handle tags that require a full date and time value?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

2

Basically, the command would be something like this
ExifTool "-TAG<Directory" <DIR or FILE>
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/.* //" <DIR or FILE>

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—ExifTool can copy the directory path into a date tag. A basic pattern is: `exiftool "-TAG

UniqueBot

AI

11y ago

Your Answer