ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: tommyzebman on February 19, 2019, 12:41:45 PM

Title: Syntax questions " ", $, % Warning: several simple syntax questions.
Post by: tommyzebman on February 19, 2019, 12:41:45 PM
I am confused when these are needed and when not.  I get the basic notion of = used to insert new data in metadata tag field VS. < which copies data from one tag field to another.

However for example given:    -artist=me  or -artist="Phil Harvey"  WHEN IS " " NEEDED ?   When is $ needed in front of a tag name?

This example was given which does work:  "-copyright<$datetimeoriginal Bill Jones"   When is $ needed in front of a tag name?  This is copying data from one tag to another but also adding new text.  Why " " around the entire expression in this case ?  If I attempt to add another text phrase in front of  $datetimeoriginal such "-copyright<Copyright - $datetimeoriginal Bill Jones"  it is REJECTED by exiftool.  I do not see any clear explanation, other than going through dozens of examples, of the various syntax rules.  Can a tag be inserted in the middle of text and then use = instead ?

I am sure there is a simple, logical answer for those that know.

Thanks.
Title: Re: Syntax questions " ", $, % Warning: several simple syntax questions.
Post by: Phil Harvey on February 19, 2019, 12:48:34 PM
Hi Tommy,

Quote
However for example given:    -artist=me  or -artist="Phil Harvey"  WHEN IS " " NEEDED ?

On Windows, you need quotes around an argument if it contains a space (and maybe other special characters, like maybe a semicolon.  You would have to read up about your terminal app for details).  If inside a .bat file, all % characters need to be doubled.

Quote
When is $ needed in front of a tag name?

Only when embedding a tag value inside a string, or when using an advanced formatting expression.

Quote
If I attempt to add another text phrase in front of  $datetimeoriginal such "-copyright<Copyright - $datetimeoriginal Bill Jones"  it is REJECTED by exiftool.

This should work.

Quote
Can a tag be inserted in the middle of text and then use = instead ?

No.  See common mistake 5c (https://exiftool.org/mistakes.html#M5).

- Phil
Title: Re: Syntax questions " ", $, % Warning: several simple syntax questions.
Post by: StarGeek on February 19, 2019, 01:10:11 PM
On Windows, you need quotes around an argument if it contains a space (and maybe other special characters, like maybe a semicolon.  You would have to read up about your terminal app for details).  If inside a .bat file, all % characters need to be doubled.

Other characters include the caret ^, ampersand &, pipe |, and greater/less than signs.  The caret is an escape character and will be dropped to escape the next character if not enclosed by quotes.  The ampersand will allow multiple commands on the same line to be run in sequence if not enclosed.  And the pipe character will pipe, of course.  Greater/less than signs cause file redirection, but that's pretty much already covered by the docs.

To include double quotes, I believe you need three quotes.  So to include "Quoted" text, it would be something like -Description=""""Quoted""" text"
Title: Re: Syntax questions " ", $, % Warning: several simple syntax questions.
Post by: tommyzebman on February 19, 2019, 02:47:23 PM
Thanks to all.  It seems I am on my way now to using Exiftool more intelligently.