ExifTool Forum

ExifTool => Newbies => Topic started by: camner on January 12, 2014, 01:38:20 AM

Title: batch copy XMP sidecar data to jpg files
Post by: camner on January 12, 2014, 01:38:20 AM
I have a bunch of jpg files with sidecar xmp files that contain a (small) amount of information, in particular, IPTC Title fields.  What I'd like to do is to copy these fields into the jpg files themselves in batch mode, ideally recursively through folders, though I can live without that if needed.

It strikes me that ExifTool should probably be able to do this, but I couldn't figure out from the documentation how to use the batch processing facility with tagsfromfile command.

(Am I right to presume that Exiftool will overwrite any existing Title information in the jpg file with what is in the sidecar file but will NOT alter any field already in the jpg file that is NOT contained in the XMP file?)

Thank you.
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Phil Harvey on January 12, 2014, 08:02:47 AM
The Metadata Sidecar Files (https://exiftool.org/metafiles.html) page gives lots of information on this subject, but doesn't give the specific example that you are looking for:

exiftool -tagsfromfile %d%f.xmp -all:all -r -ext jpg DIR

This command will copy all XMP tags from the XMP files to the same XMP tags in the JPG file.  Other tags will not be touched.  The -all:all keeps the tags from commuting to EXIF, IPTC, or another XMP namespace, and the -r recursively processes sub-directories.

- Phil

Edit: I have added this as example 15 (https://exiftool.org/metafiles.html#EX15) on the Metadata Sidecar Files page.
Title: Re: batch copy XMP sidecar data to jpg files
Post by: camner on January 12, 2014, 11:49:26 AM
Thank you for your quick reply...this will be very helpful in a project I have.

I did consult the Metadata Sidecar Files page, which gave me enough information to think that it might be possible, but given my "Newbie" status with Exiftool, not enough info to determine exactly how to do it.

A followup question if you don't mind:

Can I process only one tag in the xmp file, for example, copy the contents of the <title></title> field to the caption field?

Thanks again.
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Phil Harvey on January 12, 2014, 12:46:17 PM
Quote from: camner on January 12, 2014, 11:49:26 AM
Can I process only one tag in the xmp file, for example, copy the contents of the <title></title> field to the caption field?

Yes.  Just specify the tag(s) you want to copy instead of -all:all in the command I gave.  I don't know exactly what you mean by "the caption field", but if (for example) you meant the IPTC:Caption-Abstract, the argument would be "-IPTC:Caption-Abstract<XMP:Title".

- Phil
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Gandy on December 15, 2017, 12:28:26 PM
the syntax above creates with my setup a list of new *.jpg files with a new timestamp of creation date an time. The Original files getting the extension *.jpg_original. Is it possible, that the new files keeps the original creation date & time? Can I avoid duplicating the jpg's at all?
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Phil Harvey on December 15, 2017, 12:37:47 PM
Add -overwrite_original and -P to your command.

- Phil
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Gandy on December 15, 2017, 03:21:21 PM
thanks for the fast replay. This time the creation date & time was set to the last modification date. I am still hoping to keep the original creation date & time.

I have not found the term: "-overwrite_original". Where it is documented?
Title: Re: batch copy XMP sidecar data to jpg files
Post by: Phil Harvey on December 15, 2017, 03:34:49 PM
Run exiftool with no arguments to see the documentation.  Or you can see it here as a web page (https://exiftool.org/exiftool_pod.html) or download it as a PDF (https://exiftool.org/exiftool_pod.pdf).  It is in the "Processing Control" section of the Options documentation (here in the web page (https://exiftool.org/exiftool_pod.html#Processing-control)).

What operating system are you running?  Mac I guess.  See -overwrite_original_in_place then.

This is discussed in FAQ 24 (https://exiftool.org/faq.html#Q24).

- Phil