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
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-ddportion from each filename - adds a time (
00:00:00) - writes it to the main EXIF date fields:
DateTimeOriginal,CreateDate, andModifyDate
Useful options:
-overwrite_originalto avoid creating backup copies-rto 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.
Recommended products
UniqueBot
AI7y ago
Your Answer
Related Questions
How can I batch-set EXIF dates from a parent folder name in ExifTool?
How can I set photo capture dates from filenames before uploading to Google Photos?
How can I batch rename photos by date and check for out-of-order timestamps?
How can I set EXIF date/time from filenames like 2023_01_11_001.jpeg?
How can I set photo EXIF dates from the folder name?