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?


1 Answer 1


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>

  • 1
    \$\begingroup\$ It doesn't seem to work. I tried: exiftool "-CreateDate<Directory 00:00:00" -r ./ and got errors like: Warning: No writable tags set from ./2015/03/03/IMG_3472.JPG Maybe it has to do with the fact that the Directory tag starts with a ./ ? \$\endgroup\$
    – wilk
    Commented Aug 7, 2015 at 13:04
  • \$\begingroup\$ Two things to try, mistakes on my part. If you're running on linux/mac, change the double quotes to single quotes. Also, I forgot to add a dollar sign to the assignment because of mixing tag and text. So try this exiftool '-CreateDate<$Directory 00:00:00' -r ./ The ./ should not be a problem at all. The program's author uses similar examples all the time and I just tested it on my Windows computer and it worked fine. \$\endgroup\$
    – StarGeek
    Commented Aug 7, 2015 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.