Question regarding ExifTool statements

Started by mklein, November 30, 2013, 08:20:13 AM

Previous topic - Next topic

mklein

Hi,

could you explain the following statements to?

1.)

-execute "-IPTC:Keywords-<$XMP:Country" "-XMP:Subject-<$XMP:Country"

I think this will delete the value of the country field (e.g. "Austria") from the IPTC keywords as well as from the XMP keywords. Is this correct?

2.)

-execute "-XMP:Subject+<$XMP:Country" -if "not $XMP:Subject=~/$XMP:Country/" -execute "-IPTC:Keywords+<$XMP:Country"

I think this creates a new IPTC and XMP keyword with the value of the country field, right? But does the if statement do? And what does "=~" mean and what are the "/" for? Could you explain these three statements please?


Thanks a lot

Regards
Michael

Phil Harvey

Hi Michael,

Quote from: mklein on November 30, 2013, 08:20:13 AM
-execute "-IPTC:Keywords-<$XMP:Country" "-XMP:Subject-<$XMP:Country"

I think this will delete the value of the country field (e.g. "Austria") from the IPTC keywords as well as from the XMP keywords. Is this correct?

Yes, but the -execute is extraneous in this context (either that, or it should appear after the arguments), and I would recommend dropping the "$" sign:

"-IPTC:Keywords-<XMP:Country" "-XMP:Subject-<XMP:Country"

Quote-execute "-XMP:Subject+<$XMP:Country" -if "not $XMP:Subject=~/$XMP:Country/" -execute "-IPTC:Keywords+<$XMP:Country"

I think this creates a new IPTC and XMP keyword with the value of the country field, right?

Yes, but my previous comment applies.  Another way to do this is:

"-XMP:Subject-<XMP:Country" "-XMP:Subject+<XMP:Country"

which avoids one pass to read the metadata first, but will write all files regardless of whether or not the country was in the subject beforehand.

QuoteBut does the if statement do? And what does "=~" mean and what are the "/" for? Could you explain these three statements please?

From the exiftool application documentation:

       -if EXPR
            Specify a condition to be evaluated before processing each FILE.
            EXPR is a Perl-like logic expression containing tag names prefixed
            by "$" symbols.  It is evaluated with the tags from each FILE in
            turn, and the file is processed only if the expression returns
            true.  [...]


The Perl "~=" operator applies a regular expression to a variable.  In the simplest form, it looks for a matching substring within the variable.  Google "Perl regular expressions" for all of the details.

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

mklein

Hi Phil,

Thanks a lot, I solved my problems now.

But there's one question left. I want to delete a XMP keyword that's called "99 - LOCATION".
What is the statement to delete this keyword via ExifTool?

I tried: "-XMP:Subject-<99 - LOCATION"
But this didn't work - I think it's because of the symbol "-".

How can I delete this keyword?

Thanks again

Regards,
Michael

Phil Harvey

Hi Michael,

Quote from: mklein on December 02, 2013, 02:44:40 PM
I tried: "-XMP:Subject-<99 - LOCATION"

This doesn't work because there is no tag name called "99 - LOCATION".

If you want to delete a specific value, use -=, not -<.

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