Batch Creation of XML files from PDF

Started by Stephen Marsh, November 19, 2016, 07:59:20 PM

Previous topic - Next topic

Stephen Marsh

I am trying to create individual XML files from a source directory of PDF files. After a lot of searching of the documentation and the forum and experimentation I thought that I had finally found the answer with the following command:

exiftool -o %d%f.xml -X -r INPUT_FOLDER

However the results appear to simply be the PDF file copied and renamed as XML, rather than the metadata from the PDF written as XML.

I have also tried variations on:

exiftool -X a.jpg > a.xml

Swapping the filename/path for a -r DIR, however it is not that simple... It works for one file, but not for a batch.

So how do I create a batch output of XML files named after the input files, containing the metadata of the input files, writing to the same input directory?

Phil Harvey

You want the -w option, not -o:

exiftool -w xml -X -r DIR

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

Stephen Marsh

Thank you Phil, I'll lookup those arguments to try to figure out where I went wrong.

Phil Harvey

Maybe this diagram will help (from here).  Note the arrows associated with -o and -w, and also note that -X (-xmlFormat) is an output text formatting option.

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