ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mjb on June 25, 2021, 04:14:44 AM

Title: Extracting XMP records for multiple files
Post by: mjb on June 25, 2021, 04:14:44 AM
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



Title: Re: Extracting XMP records for multiple files
Post by: Phil Harvey on June 25, 2021, 07:14:00 AM
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
Title: Re: Extracting XMP records for multiple files
Post by: mjb on June 25, 2021, 08:20:59 AM
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


Title: Re: Extracting XMP records for multiple files
Post by: Phil Harvey on June 25, 2021, 09:00:49 AM
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 (https://exiftool.org/ExifTool.html#Compact) (eg. -api compact=shorthand)

- Phil
Title: Re: Extracting XMP records for multiple files
Post by: mjb on June 25, 2021, 10:07:13 AM
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