Extracting XMP from EXIF to file - file doesn't exist.

Started by Joanna Carter, November 27, 2020, 12:20:59 PM

Previous topic - Next topic

Joanna Carter

Greetings.

I'm using my Swift wrapper to generate the command line for constructing an XMP file from the XMP data in an image file.

exiftool -xmp -b SRC.EXT > DST.xmp

... and I am getting errors on execution

Error: File not found - >
Error: File not found - /Users/joannacarter/Pictures/Didier.xmp

It looks like it is treating the redirect (>) as a file name

My wrapper has to send an array of "arguments" to the executing process.

Could someone please split that command line into arguments?

I already have -xmp and -b but I'm not sure how to group/split the last three.


Phil Harvey

Hi Joanna,

Your wrapper probably doesn't support shell redirection (ie. > DST.xmp).  Instead, use the -w or -W option.  To wit:

exiftool
-xmp
-b
-W
DST.xmp
SRC.EXT


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

Joanna Carter

Thank you for that hint.

However...

Here are the arguments as an array

▿ 5 elements
  - 0 : "-xmp"
  - 1 : "-b"
  - 2 : "-W"
  - 3 : "/Users/joannacarter/Pictures/Didier.xmp"
  - 4 : "/Users/joannacarter/Pictures/Didier.jpg"


It certainly runs OK but the xmp file is not created. Any ideas?

Running on a Mac with Catalina - file permission issue?

Phil Harvey

That looks good to me.  The best way to debug this is to take a look at the exiftool stdout and stderr outputs to see what the messages are trying to tell you.

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

Joanna Carter

Well, I got that bit sorted. the final arguments list is

  - 0 : "-xmp"
  - 1 : "-b"
  - 2 : "-textOut!"
  - 3 : "xmp"
  - 4 : "/Users/joannacarter/Pictures/JNA_0052.NEF"


Many thanks

Phil Harvey

If that works, I don't understand why your command with the -W didn't create an output file (the "!" doesn't affect the creation of a new output file -- it only allows overwriting an existing file).

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