ExifTool Forum

ExifTool => Newbies => Topic started by: richo on November 08, 2020, 12:41:54 PM

Title: Write specified tags into .xmp file with name of existing raw file
Post by: richo on November 08, 2020, 12:41:54 PM
Is it possible to only write specified tags into .xmp file which names i basedon existing raw file in the folder?
I tried

exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -o %d%f.xmp  2020-10-24-00000?.raf

but it copied all tags from the raf files
Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: StarGeek on November 08, 2020, 01:04:01 PM
See the Metadata Sidecar Files (https://exiftool.org/metafiles.html) page.

It would basically be example #13 (https://exiftool.org/metafiles.html#EX13) but replace the -TagsFromFile @ with the tags you want to set
exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -srcfile %d%f.xmp /path/to/files/
Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: Phil Harvey on November 08, 2020, 06:42:48 PM
Quote from: StarGeek on November 08, 2020, 01:04:01 PM
exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -srcfile %d%f.xmp /path/to/files/

You may want to exclude XMP files from this command in case some already existed.  ie)

exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -srcfile %d%f.xmp --ext xmp /path/to/files/
Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: richo on November 09, 2020, 07:15:45 AM
Thank you both for your kind help, this works very well.
Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: richo on November 09, 2020, 07:36:05 AM
Please excuse me if I am annoying, but I really love power of this tool now for many years and every time I learn something there is new idea popping out.
Now you showed me how to write only specified tags to xmp named after a raw file. Now I have folder where are some images for whos I have gps track file and few of them I do not have. I know where those not in gps track file where created and I have GPS coordinate of the place.

Is it possible to create xmp file with those coordinates, but only for those RAW files which do not have already xmp file?
Thank you.
Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: Phil Harvey on November 10, 2020, 06:55:42 AM
I would have to say that this is possible, but I don't understand exactly what you want so I can't give an example.  Something like this perhaps?:

exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -o %d%f.xmp --ext xmp /path/to/files/

You will get errors for all the XMP files that already exist.

- Phil

Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: richo on November 10, 2020, 11:06:38 AM
Quote from: Phil Harvey on November 10, 2020, 06:55:42 AM
I don't understand exactly what you want so I can't give an example.

I first run -geotag using my tracking.gps file on and creates sidecar xmp for all raw file. Some of them will be not covered by tracking.gps because i did not have my tracking turned on. those will not have xmp file created. I will manually locate GPS coordinates (based on picture i will remember when was it and use online maps to find coordinates).
For those I like to run command similar to what you wrote. It is often that multiple photos are shot on same location so I like to run (based on your last example something like this:

exiftool -GPSLatitude=46.9652522N -GPSLongitude=8.4770156E -o %d%f.xmp --ext xmp 2020-10-25-0023?.raf

which should take all raw files ending with 30...39. for example, it may be the case that *30 *31 already have xmp files, those I do not want to change.


Title: Re: Write specified tags into .xmp file with name of existing raw file
Post by: Phil Harvey on November 11, 2020, 03:04:29 PM
That command should do it then.