Extracting XMP records for multiple files

Started by mjb, June 25, 2021, 04:14:44 AM

Previous topic - Next topic

mjb

Hello

I am trying to extract complete XMP records for a folder of images and write them all to a single text file

I have been using the command
ExifTool -xmp -b <folder_of_images> > xmp_records.txt
   
However, the output from this is a single line of text for all files.

Is there a way to format the output to at least place the record string for each file on a new line?
Or even to format the record strings with a new line for each tag and nested tags indented?

Thanks

Michael




Phil Harvey

Hi Michael,

To reformat the xmp will require that it be rewritten.  Doing this, you will lose any tags that ExifTool doesn't know about (ie. uncommon non-standard information).  The command uses a couple of the more advanced features of ExifTool:

exiftool -o -.xmp "-all:all<xmp:all" DIR > out.xmp

- 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 ($).

mjb

Hello Phil

That's brilliant and does exactly what I asked for. Thanks very much.
(...next project is to decipher the command...)

As an extra request, is there also a way to precede the writing of each record with the associated file name/path?

Regards

Michael



Phil Harvey

Hi Michael,

Quote from: mjb on June 25, 2021, 08:20:59 AM
is there also a way to precede the writing of each record with the associated file name/path?

I can't think of a way to do exactly this, but you can embed the file name in the XMP.  Here I put it in the OriginalFileName tag:

exiftool -o -.xmp "-all:all<xmp:all" "-originalfilename<filename" DIR > out.xmp

Note also that you have various options to control the XMP formatting using the API Compact option (eg. -api compact=shorthand)

- 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 ($).

mjb

Hey Phil

That's great once again. That does what I'm after so thanks very much.

Will have a look at the API Compact option.

Regards
Michael