A file called *.xmp

Started by Alan Clifford, September 21, 2011, 05:32:37 PM

Previous topic - Next topic

Alan Clifford


I'm not sure if I should have expected this but

exiftool -@ keywordsandstuff.Samburu.args *.xmp

created a file called *.xmp if there were no files with .xmp already existing.

(it didn't if I used *xmp, it reported an error)

This happened on both mac and linux

The keywordsandstuff.Samburu.args file contained: 

# use eg exiftool -@ keywordsandstuff.args files
# use eg exiftool -@ keywordsandstuff.args -ext jpg .
# use eg exiftool -@ keywordsandstuff.args *.mov.xml
-overwrite_original_in_place
-countrycode=KE
-location=Samburu National Reserve
-mwg:keywords-=Buffalo Springs National Reserve
-mwg:keywords-=Samburu National Reserve
-mwg:keywords+=Samburu National Reserve
-mwg:keywords-=Buffalo Springs
-mwg:keywords-=Samburu
-mwg:keywords+=Samburu
-mwg:keywords-=Kenya
-mwg:keywords+=Kenya


Phil Harvey

Very odd.  It doesn't happen for me on my Mac.

Ah.  I just tried this command in bash, and it does what you said.  This appears to be a Bourne shell peculiarity.  C shells give a "No match" message and abort if the wildcard doesn't match any files (I use tcsh myself), but Bourne shells apparently pass the wildcard through in this case.

Interesting.

I'll do some googling tomorrow to see if there are any work-arounds because this definitely isn't a desired behaviour.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

#2
I was curious so I just did a bit of googling.  Try this in your Bourne shell before running exiftool:

shopt -s nullglob

This should set the shell option to cause the Bourne shell (version 2) to convert a non-matching wildcard to a null string, which makes a lot more sense to me.

I don't think this is something I can patch in exiftool because there is no way for me to tell the difference between *.xmp and '*.xmp' on the command line.  The former being wildcard match, and the latter a literal * in the file name.

This is yet another reason to avoid using wildcards on the command line.  You can avoid this whole problem by letting exiftool do the file identification for you:

exiftool -@ keywordsandstuff.Samburu.args -ext xmp .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

Quote from: Phil Harvey on September 21, 2011, 07:17:38 PM
This is yet another reason to avoid using wildcards on the command line.  You can avoid this whole problem by letting exiftool do the file identification for you:

exiftool -@ keywordsandstuff.Samburu.args -ext xmp .

- Phil

I shall kick the bad habit.

Alan