ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: philbond87 on July 02, 2020, 12:17:16 PM

Title: Problem writing to a tag from a text file (in a shell)
Post by: philbond87 on July 02, 2020, 12:17:16 PM
I'm trying to execute the following command through a shell (on Mac OS):

exiftool -overwrite_original_in_place -usageterms<= /Users/JohnDoe/Library/Application Support/MyApp/UsageTerms.txt /Users/JohnDoe/Library/Application Support/MyApp/Image.jpg

What I'm getting is "bash: =: No such file or directory"

Both files do exist at the paths sent to exiftool.
It seems as though exiftool is ignoring everything after the "<" symbol.

For example, if I have a space after the equals sign I get the message above.
If I have no spaces after the "<=" combination I get:

bash: =/Users/JohnDoe/Library/Application Support/MyApp/UsageTerms.txt: No such file or directory

What am I doing wrong?
Thanks!
Title: Re: Problem writing to a tag from a text file (in a shell)
Post by: StarGeek on July 02, 2020, 12:24:09 PM
From the docs (https://exiftool.org/exiftool_pod.html#TAG-DATFILE-or--TAG-FMT)
   Note that quotes are required around this argument to prevent shell redirection since it contains a < symbol.

Try
'-usageterms<=/Users/JohnDoe/Library/Application Support/MyApp/UsageTerms.txt'

Additionally, any argument that has a space in it either needs quotes or needs to escape the space
'/Users/JohnDoe/Library/Application Support/MyApp/Image.jpg'
or
/Users/JohnDoe/Library/Application\ Support/MyApp/Image.jpg
Title: Re: Problem writing to a tag from a text file (in a shell)
Post by: philbond87 on July 02, 2020, 12:45:59 PM
Thanks for that. I feel I'm getting closer.

Now, however, my new command is:
exiftool -overwrite_original_in_place '-UsageTerms<=/Users/JohnDoe/Library/Application\ Support/MyApp/UsageTerms.txt' /Users/JohnDoe/Library/Application\ Support/MyApp/Image.jpg

And I'm getting the error:
Error opening file /Users/JohnDoe/Library/Application\ Support/MyApp/UsageTerms.txt
Nothing to do.

Title: Re: Problem writing to a tag from a text file (in a shell)
Post by: philbond87 on July 02, 2020, 12:55:49 PM
Ah... never mind.
I forgot to "un" escape the spaces in the path once I single quoted.