Author Topic: Problem writing to a tag from a text file (in a shell)  (Read 87 times)

philbond87

  • Jr. Member
  • **
  • Posts: 20
Problem writing to a tag from a text file (in a shell)
« on: July 02, 2020, 12:17:16 PM »
I'm trying to execute the following command through a shell (on Mac OS):

Code: [Select]
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
Code: [Select]
"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:

Code: [Select]
bash: =/Users/JohnDoe/Library/Application Support/MyApp/UsageTerms.txt: No such file or directory
What am I doing wrong?
Thanks!

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3795
Re: Problem writing to a tag from a text file (in a shell)
« Reply #1 on: July 02, 2020, 12:24:09 PM »
From the docs
   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
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

philbond87

  • Jr. Member
  • **
  • Posts: 20
Re: Problem writing to a tag from a text file (in a shell)
« Reply #2 on: July 02, 2020, 12:45:59 PM »
Thanks for that. I feel I'm getting closer.

Now, however, my new command is:
Code: [Select]
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:
Code: [Select]
Error opening file /Users/JohnDoe/Library/Application\ Support/MyApp/UsageTerms.txt
Nothing to do.

philbond87

  • Jr. Member
  • **
  • Posts: 20
Re: Problem writing to a tag from a text file (in a shell)
« Reply #3 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.