ExifTool Forum

ExifTool => Newbies => Topic started by: MrSimmo on April 06, 2025, 02:39:06 AM

Title: Wildcard use in tagsfromfile?
Post by: MrSimmo on April 06, 2025, 02:39:06 AM
Hi all,

I've been trying to fix my Google TakeOut which has been proving interesting!

The json files that come from Google TakeOut seem to be a mess. They seem to have any variety of the following formats:

IMG_3642.HEIC.supplemental-metadata.json
IMG_3642.HEIC.supplemental.json
IMG_3642.HEIC.supplementa.json
IMG_3642.HEIC.supplemental-metadata(1).json


Does anyone know how I can update this exiftool command to use any of the above?

exiftool -d "%s" -tagsfromfile %d%f.%e.supplemental-metadata.json "-DateTimeOriginal<PhotoTakenTimeTimestamp"  "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -if 'not defined $DateTimeOriginal' -overwrite_original -ext mp4 -ext jpg -ext heic -ext png -ext m4v -ext mov -api largefilesupport=1  -r .


I tried changing it to:
-tagsfromfile %d%f.%e.supplementa*.json

but it failed saying:
Warning: Error opening file - ./IMG_3642.jpg.supplementa*.json
Title: Re: Wildcard use in tagsfromfile?
Post by: Phil Harvey on April 08, 2025, 07:37:47 AM
This solution is messy, but should work:

exiftool -d "%s" -tagsfromfile %d%f.%e.supplemental-metadata.json "-DateTimeOriginal<PhotoTakenTimeTimestamp"  "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -tagsfromfile %d%f.%e.supplemental.json "-DateTimeOriginal<PhotoTakenTimeTimestamp"  "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -tagsfromfile %d%f.%e.supplementa.json "-DateTimeOriginal<PhotoTakenTimeTimestamp"  "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -tagsfromfile "%d%f.%e.supplemental-metadata(1).json" "-DateTimeOriginal<PhotoTakenTimeTimestamp"  "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" -if 'not defined $DateTimeOriginal' -overwrite_original -ext mp4 -ext jpg -ext heic -ext png -ext m4v -ext mov -api largefilesupport=1 -r .

But note you will get a lot of warnings for the json files with the wrong names.

Alternatively, you could first rename all of the json files to a consistent naming scheme.  Maybe something like this:

exiftool IMG_*.json -filename=%13f.json DIR

- Phil
Title: Re: Wildcard use in tagsfromfile?
Post by: StarGeek on April 08, 2025, 03:16:51 PM
One important thing to remember is that Google does not remove any metadata from your files. The downloaded files will have the same metadata as when they were uploaded.

The only time you want to copy data from the Takeout files is if you made changes on the Google site or if the files never had any data to begin with, such as images downloaded from social media (FB, Insta, WhatsApp) or screenshots.

Double check you files with the command from FAQ #3 (https://exiftool.org/faq.html#Q3) to make sure you want to do this.