Question

I would like to run the shell script like below with chosen folder:

exiftool -k -P -overwrite_original_in_place -ImageDescription= /Users/User/Pictures/2013.09.22\ -\ Парк\ Горького/*.ARW

It works well if I do it thru the Terminal. However, when I try to automate with Automator:

  1. Choose Finder object
  2. Set Value of Variable (path)
  3. Run shell-script: exiftool -k -P -overwrite_original_in_place -ImageDescription= $1*.ARW

exiftool can not find the file. I've tried $1\*.ARW - it doesn't help.

Was it helpful?

Solution

You need to double-quote the reference to $1 (... -ImageDescription= "$1"*.ARW), or else the shell will split it into separate arguments on the spaces in the path.

Other things that might or might not be problems depending on exactly how you set the path variable: First, if it doesn't end with a trailing forward-slash, you'll need to add it to the reference (... -ImageDescription= "$1"/*.ARW). Second, if you embed the escapes (the backslashes), it's not going to work right. Embedding quotes and escapes in variable values doesn't do what you think it does, and almost always causes trouble; so just don't do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top