0

All my photos - jpegs - have the naming convention YYYY-mm-dd-nnn (1971-12-00-001) and I've recently uploaded them to Google Photos. On my PC I can sort them into date order but Google Photos uses Date Created which is not the same date and the result is that photos are all over the place.

What I want to do is batch change Date Created to the date in the filename.

I've looked at Bulk File Renamer and File Date Corrector but can't work out how to perform that task with either of those utilities.

Can anyone suggest if it's possible to achieve this and, if so how?

TIA Simon

  • All I can think of is System.IO.File.SetCreationTime from the .net-libraries. Just Enumerate over all files, take their name, convert it into a datetime and set the creation time. – Horitsu Feb 13 at 5:07
  • Thanks but also beyond my skills. – Simon Meade Feb 13 at 5:44
  • When you say "Date created" do you mean EXIF metadata (as the current answer assumes) or filesystem metadata (as the comment above assumes)? Or are you unsure and that is effectively part of the question? – Peter Taylor Feb 13 at 14:17
  • 1
    @Peter Taylor, since the OP wanted to use Google Photos to sort the images by date, I went ahead and expanded my answer below to include the variety of metadata that Google Photos will read to determine the order. This list includes EXIF, XMP, and IPTC dates as well as falling back to the system modify timestamp if no other data appears embedded in the file. – StarGeek Feb 13 at 18:51
4

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
  • exiftool is a bit beyond me I'm afraid. I'm not exactly a novice but I do have limitations. – Simon Meade Feb 13 at 5:42
  • 2
    @SimonMeade Powerful tools have steep learning curves; this answer bypasses that by handing you a canned solution with one easy-to-fill-in blank. You don't have anything to lose by making copies of a handful of images and trying it out. – Blrfl Feb 13 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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