How can I batch set JPEG photo dates from the date in the filename before uploading to Google Photos?

Asked 2/12/2019

1 views

2 answers

0

My JPEG files are named in a date-based format like YYYY-mm-dd-nnn (for example, 1971-12-00-001). After uploading them to Google Photos, the images appear out of order because Google Photos is using the file's stored date metadata rather than the date shown in the filename.

I want to batch update the photo date metadata so it matches the date embedded in each filename. Is there a way to do this automatically for many files at once?

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

Photography Stack Exchange contributor

7y ago

2 Answers

6

If you're comfortable with the command line, try exiftool.

I'd suggest this command:
exiftool "-alldates<${filename;m/(\d{4}-\d\d-\d\d)/;$_=$1} 00:00:00" DIR

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

What this does is take the filename, match the appropriate date numbers, add a time, and copy that to the three main embedded EXIF timestamps (DateTimeOriginal, CreateDate, and ModifyDate).

You can run it on multiple directories or a mix of directories and filenames at the same time. Just replace DIR in the above command with the directory you wish to process.

Since Google Photos is the destination for the images, it should be noted that Google Photos will read the time stamps from a large number of embedded dates. Unfortunately, there is no preset order and it appears to be dependent upon the order the data appears in the file, with the exception of the GPS and System times appearing to always be the last choice. The applicable tags, using exiftool nomenclature, are:

  • EXIF:CreateDate
  • EXIF:DateTimeOriginal
  • EXIF:ModifyDate
  • IPTC:DateCreated+IPTC:TimeCreated
  • IPTC:DigitalCreationDate+IPTC:DigitalCreationTime
  • XMP-exif:DateTimeDigitized
  • XMP-exif:DateTimeOriginal
  • XMP-photoshop:DateCreated
  • XMP-xmp:CreateDate
  • XMP-xmp:ModifyDate
  • GPS:GPSDateStamp+GPS:GPSTimeStamp
  • System:FileModifyDate

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

user37960

7y ago

0

AI Answer

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

Yes — exiftool is a good way to batch write the date from the filename into the image metadata that Google Photos reads.

Example command:

exiftool "-alldates<${filename;m/(\d{4}-\d\d-\d\d)/;$_=$1} 00:00:00" DIR

What it does:

  • reads the YYYY-mm-dd portion from each filename
  • adds a time (00:00:00)
  • writes it to the main EXIF date fields: DateTimeOriginal, CreateDate, and ModifyDate

Useful options:

  • -overwrite_original to avoid creating backup copies
  • -r to process subfolders recursively

Replace DIR with your folder path, or use specific filenames instead.

This is the right approach because Google Photos commonly relies on embedded EXIF timestamps rather than the file system’s created date. So changing the EXIF dates is more reliable than only changing the OS-level file creation date.

UniqueBot

AI

7y ago

Your Answer