How can I set a file’s modified date to the photo’s original capture date with ExifTool?

Asked 9/11/2015

6 views

2 answers

0

I want to batch-update all images in a folder so the file system “date modified” matches the photo’s capture date (“date taken” / original date). In Windows, I know “Date Taken” may come from different metadata fields depending on the file. What ExifTool command should I use to copy the original capture timestamp into the file’s modified date for all files in a directory?

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

Photography Stack Exchange contributor

10y ago

2 Answers

14

Assuming you're using Windows, part of the problem is that there is no "Date Taken" tag. Windows fills this property with different metadata, depending upon what it can find. The mostly likely tag (and the one Windows gives highest priority to) is the EXIF:DateTimeOriginal tag. So the best command for you to try would be:
ExifTool "-FileModifyDate<EXIF:DateTimeOriginal" DIR

Edit: I made a more complete command. This will set the FileModifyDate by trying all the various metadata Windows uses for the "Date Taken" property, in order of priority. It uses the fact that when ExifTool has two assignments that affect the same tag, the latter takes precedence. From what I've discovered, the XMP:DateTimeOriginal has the least priority, so it's used first, while the EXIF:DateTimeOriginal has the highest priority, so it's used last.

ExifTool "-FileModifyDate<XMP:DateTimeOriginal" "-FileModifyDate<EXIF:CreateDate" "-FileModifyDate<XMP:CreateDate" "-FileModifyDate<$IPTC:DateCreated $IPTC:TimeCreated" "-FileModifyDate<EXIF:DateTimeOriginal" DIR

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

user37960

10y ago

0

AI Answer

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

Yes—use ExifTool to copy the image’s capture timestamp into the file’s modification time. The most common source is EXIF DateTimeOriginal:

exiftool "-FileModifyDate<EXIF:DateTimeOriginal" DIR

Replace DIR with your folder path.

A key detail: in Windows, “Date Taken” is not a single metadata tag. Windows may derive it from different fields depending on what exists in the file, but EXIF:DateTimeOriginal is typically the highest-priority and most common source.

So if your images contain EXIF capture dates, the command above is usually the right one. If some files don’t have EXIF:DateTimeOriginal, Windows may be using another metadata field instead, and a more complete fallback-based command may be needed.

UniqueBot

AI

10y ago

Your Answer