ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Infobleep on August 06, 2011, 07:37:50 AM

Title: Problem copying an xmp tag using -tagsfromfile
Post by: Infobleep on August 06, 2011, 07:37:50 AM
Dear Phil

Your programme is really useful, especially when programmes like Aperture 3 like to mess around with the file attribute dates and times of master files. For example moving a referenced master from one directory to another trashes all the file attribution creation dates. You don't even have to have actually done any work to the file, just move it. I know at file level it is copying and deleting but I would expect the attributes to be preserved.

Anyway I digress. I am trying to copy information from an outputted XMP file on my Mac but I can't get the tag to copy to the location I wish. When I run the following command:
exiftool -tagsfromfile '2011-03-19 @ 08-14-13 -.xmp' -xmp:Instructions>iptc:SpecialInstructions '2011-03-19 @ 08-14-13 - copy.JPG' -L -overwrite_original_in_place -P

The Instructions tag is copied to an xmp:instructions tag which is created in the JPG, rather than the iptc:SpecialInstructions tag.
An extract of the output is as follows (I've included other preexisting tags generated using EXIFTOOL before I brought the photo into Aperture)
JPEG APP13 (202 bytes):
  + [Photoshop directory, 188 bytes]
  | IPTCData (SubDirectory) -->
  | + [IPTC directory, 175 bytes]
  | | CurrentIPTCDigest = ..c.....E....Q..
  | | -- IPTCApplication record --
  | | By-line = Timothy Fintan Langner
  | | ApplicationRecordVersion = 4
  | | Contact = Timothy Fintan Langner (e-mail: timothy.langner@gmx.net)
  | | CopyrightNotice = Copyright (c) 2011 Timothy Fintan Langner (e-mail: timothy.lang[snip]
JPEG APP1 (3022 bytes):
  + [XMP directory, 2993 bytes]
  | XMPToolkit = Image::ExifTool 8.56
  | Instructions = Photo taken by man who was on the same sleeper train.
  | Rating = 0
JPEG DQT (130 bytes):
JPEG SOF0 (15 bytes):
JPEG DHT (416 bytes):
JPEG SOS


I then tried copying the tag within the JPG but that didn't do anything or if it did, it copied it back to the same location.
exiftool -Instructions>IPTC:SpecialInstructions '2011-03-19 @ 08-14-13 - copy.JPG' -L -overwrite_original_in_place -P

I also get a warning message:
Warning: Superfluous BOM at start of XMP - 2011-03-19 @ 08-14-13 -.xmp

But I'm aware that will be due to the way the original XMP is formatted. I use a plugin to generate it. It isn't a problem as such either. What I wasn't aware though, was that you can read CSV files. Amazing really because I can output those from Aperture and I think I can get version names out too. So I may even end up using CSV files to do the same work. However I have a feeling the same problem will arise because I'm probably not writing the above syntax correctly or I'm missing something out.

Kind regards

Tim
Title: Re: Problem copying an xmp tag using -tagsfromfile
Post by: Phil Harvey on August 06, 2011, 10:05:16 PM
Hi Tim,

You need quotes around arguments containing greater/less than symbols (> <).  These symbols have special meanings for the shell, and are used to redirect console output to/from a file.

You may find some funny files in your working directory with names like "iptc:specialinstructions" from what you have done.

- Phil
Title: Re: Problem copying an xmp tag using -tagsfromfile
Post by: Infobleep on August 14, 2011, 06:34:09 AM
Thanks Phil.

It's always minor syntax errors that trip me up, especially in areas I don't know so much about.

I don't think I had any odd files around but you never know as I wasn't looking or expecting them.

Kind regards

Tim
Title: Re: Problem copying an xmp tag using -tagsfromfile
Post by: Infobleep on August 14, 2011, 10:07:33 AM
Hi there

Following on from my previous message. I got the command to work for a single file but when I tired to then do it for a directory I got an error message.

exiftool -tagsfromfile %d%f.xmp '-xmp:Description>iptc:Caption-Abstract' '2011-03-19 - ' -L -overwrite_original_in_place -P -r


Gave:
Warning: Error opening file - 2011-03-19 - /2011-03-19 @ 12-05-03 - .xmp
Warning: Superfluous BOM at start of XMP - 2011-03-19 - /2011-03-19 @ 12-05-03 -.xmp
Warning: Superfluous BOM at start of XMP - 2011-03-19 - /2011-03-19 @ 12-05-03 -.xmp


What am I doing wrong?

Kind regards


Tim
Title: Re: Problem copying an xmp tag using -tagsfromfile
Post by: Phil Harvey on August 14, 2011, 01:54:59 PM
Hi Tim,

I don't think you are doing anything wrong other having files and directories with really weird names.

I can't explain why you get the error opening the one file with a name ending in " - .xmp" unless the file is protected or there is an interference with some other software like an anti-virus utility.  The extra BOM in the XMP for the file ending in " -.xmp" (no space before the dot) may just be a problem with the software that wrote the XMP.

- Phil
Title: Re: Problem copying an xmp tag using -tagsfromfile
Post by: Infobleep on August 20, 2011, 05:03:53 PM
Phil,

Thank for your reply. Your a life saver. The problem was simple but I hadn't spotted it. When I created the file names, I titled them using the date and time and then added two - - afterwards. This was because that is where I will eventually write my descriptions of the photos, sometimes two lots, other times just 1, in which case the second - would be removed or not have been added in the first place. After that I would leave a gap before the .JPG so it might end " - - .JPG@

However the software writing out the xmp sidecar, LightBox, removed the space before the . of end file so the XMP sidecar would become " - -.XMP" and thus that is obviously why it failed. Why it worked for one file I don't know without going back over what I did.

It was my fault. I was exported the XMP side car files using the version name from Aperture and not the master file name. The names therefore didn't match.

Fortunately I have a program which can remove the space for each file.

Kind regards

Tim

[Edited to correct something I had written]