ExifTool Forum

ExifTool => Newbies => Topic started by: Buniculbroscoi on May 14, 2021, 09:32:03 PM

Title: I need 1 command for batch merge dates and time UTC+3
Post by: Buniculbroscoi on May 14, 2021, 09:32:03 PM
Not computer savvy, I've been trying to do this for hours.

I just extracted Google Takeout and I need 1 command to mass change the time in UTC +3 and get the correct the dates accordingly.

Can you help me? Thank you

Thank you in advance.






{
  "title": "IMG_0798.JPG",
  "description": "",
  "imageViews": "31",
  "creationTime": {
    "timestamp": "1494960363",
    "formatted": "16 May 2017, 18:46:03 UTC"
  },
  "photoTakenTime": {
    "timestamp": "1494958818",
    "formatted": "16 May 2017, 18:20:18 UTC"
  },
  "geoData": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  },
  "geoDataExif": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: StarGeek on May 14, 2021, 10:18:29 PM
I would first suggest that you run this command on a few of your files to see if you actually need to do anything.
exiftool -time:all -G1 -a -s /path/to/files/

Google does not remove any metadata that was in the file when you uploaded it, so unless you changed things on the Google Photos website, you don't need to do anything.
Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: Buniculbroscoi on May 15, 2021, 07:24:09 AM
Thank you for your answer.

Ι changed nothing in photos.

However, there are some photos that were sent to me via messenger, viber, etc and once I opened them, they took today's date.

The json file contains the correct date and time in "photoTakenTime" -> "formatted" , but in UTC...

I don't know exactly how many these photos are, because my library contains 60k photos. That's why I need the command.

Thank you
Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: StarGeek on May 16, 2021, 03:46:45 PM
You would use a command similar to this
exiftool -wm cg -d "%s" -tagsfromfile %d/%F.json "-AllDates<${CreationTimeTimestamp;$_+=(3*60*60)}" "-FileModifyDate<<${CreationTimeTimestamp;$_+=(3*60*60)}" /path/to/files/

I include the -wm (-writeMode) option (https://exiftool.org/exiftool_pod.html#wm-MODE--writeMode) to make sure you don't overwrite any data that is already in the files. The $_+=(3*60*60) is used to add 3 hours * 60 minutes * 60 seconds to the CreationTimeTimestamp tag in the json file, which is the UTC in epoch time.
Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: Buniculbroscoi on May 17, 2021, 02:09:09 PM
Thank you! At last something that works!!!

Test folder results:

1 directories scanned
1632 image files updated
1899 image files unchanged
  237 files weren't updated due to errors



One quick question;

I'm getting some errors like: Warning:

Error opening file - G:/Takeout/GooglePhotos/2019/IMG_4620-edited.JPG.json

Any idea about the cause/causes?

Thank you

Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: StarGeek on May 17, 2021, 02:58:29 PM
Exiftool can't find a json file by that name.

Go into that directory and take a look at IMG_4620-edited.jpg and see if you can figure out that actual name of the matching json.  In the case of duplicate file names, Google photos will add a copy number in parenthesis.  The trouble is that it isn't consistent in how it does so.  You may have to rename the json files to match the image files. 
Title: Re: I need 1 command for batch merge dates and time UTC+3
Post by: Buniculbroscoi on May 17, 2021, 03:47:22 PM
I see, I will figure it out.

Thank you very much for your time & help!

Kudos