Wildcard use in tagsfromfile?

Started by MrSimmo, April 06, 2025, 02:39:06 AM

Previous topic - Next topic

MrSimmo

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

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 to make sure you want to do this.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype