ExifTool Forum

ExifTool => Newbies => Topic started by: EvilUnicorn on November 18, 2022, 11:10:00 AM

Title: Command format. What does $ do?
Post by: EvilUnicorn on November 18, 2022, 11:10:00 AM
I'm testing the following command but see no difference in output. Should or shouldn't I use $?

exiftool -d '%Y%m%d_%H%M%%-c.%%e' '-filename<$CreateDate' P1001935.jpg
exiftool -d '%Y%m%d_%H%M%%-c.%%e' '-filename<CreateDate' P1001935.jpg

Both have the same output: 20210923_1527.jpg so what is the correct format?
Title: Re: Command format. What does $ do?
Post by: StarGeek on November 18, 2022, 11:19:30 AM
Quote from: EvilUnicorn on November 18, 2022, 11:10:00 AMShould or shouldn't I use $?

Yes...

Oh, you want more ;)

This would be Common Mistake #5b (https://exiftool.org/mistakes.html#M5).  When you using just a tag and are not mixing tag and static string, then technically you would not include the dollar sign.  But the difference is going to be so slight that you won't even notice it.

In the case of list type tags such as Keywords or Subject, there are other things to worry about, as the dollar sign changes a list into a string and would require the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) to turn it back into a list.
Title: Re: Command format. What does $ do?
Post by: Phil Harvey on November 18, 2022, 12:25:54 PM
Quote from: StarGeek on November 18, 2022, 11:19:30 AMIn the case of list type tags such as Keywords or Subject, there are other things to worry about, as the dollar sign changes a list into a string and would require the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) to turn it back into a list.

Good point.  I should add this to the above mentioned documentation (https://exiftool.org/mistakes.html#M5).

- Phil

Edit:  Oh.  It's already there. :P