Author Topic: batch copy XMP sidecar data to jpg files  (Read 5405 times)

camner

  • Jr. Member
  • **
  • Posts: 22
batch copy XMP sidecar data to jpg files
« 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.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: batch copy XMP sidecar data to jpg files
« Reply #1 on: January 12, 2014, 08:02:47 AM »
The Metadata Sidecar Files 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 on the Metadata Sidecar Files page.
« Last Edit: January 12, 2014, 09:51:04 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

camner

  • Jr. Member
  • **
  • Posts: 22
Re: batch copy XMP sidecar data to jpg files
« Reply #2 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.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: batch copy XMP sidecar data to jpg files
« Reply #3 on: January 12, 2014, 12:46:17 PM »
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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Gandy

  • Newbie
  • *
  • Posts: 2
Re: batch copy XMP sidecar data to jpg files
« Reply #4 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?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: batch copy XMP sidecar data to jpg files
« Reply #5 on: December 15, 2017, 12:37:47 PM »
Add -overwrite_original and -P to your command.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Gandy

  • Newbie
  • *
  • Posts: 2
Re: batch copy XMP sidecar data to jpg files
« Reply #6 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?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: batch copy XMP sidecar data to jpg files
« Reply #7 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 or download it as a PDF.  It is in the "Processing Control" section of the Options documentation (here in the web page).

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

This is discussed in FAQ 24.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).