Can wildcards be used to exclude files by extension?

Started by agill, March 26, 2014, 03:04:57 PM

Previous topic - Next topic

agill

Hi, I'm using exiftool v9.54 on a Mac within Run Shell Script in an Automator app to output metadata text files in a subdirectory as follows -
exiftool -a -s -u -G0:1 -w %dmetatxt/%f_meta%.c.txt --ext .JPG_original --ext .CR2_original "$f"
The "$f" at the end allows input of one or more files and/or one or more directories from the prior Ask for Finder Items action in the Automator app I've set up.

This works well, and excludes the specific files that have _original as part of their extension because of the --ext .JPG_original --ext .CR2_original.

I'm working with multiple file types in various directories however, e.g. tiff, bmp, PDF, etc., as well as jpg and cr2, so thought I'd set up a wild card to exclude all files with _original in the extension. I tried -
exiftool -a -s -u -G0:1 -w %dmetatxt/%f_meta%.c.txt --ext .*_original "$f"
but metadata files were produced for everything, including the _original files.
I tried putting in quotes e.g. --ext '.*_original', but whether using single or double quotes, the _original files were not excluded. I also tried without the preceding "." in front of the "*" but that too made no difference.

I then tried replacing the "*" with the required number of question marks (3 of which show up here as a smiley, which is why I'm not showing it :) ) but with or without quotes of any kind, and/or the preceding ".", that also did not exclude the _original files.

I'm possibly misunderstanding the use of wild cards with files, or am trying to do something that can't be done, e.g. due to how the file/directory information is passed through from Automator.

I did try searching the forum first, which is what led me to try with quotes, but other than that, can't see where the problem may be.

If anyone can provide any information or suggestions, I'd be very grateful.
Thanks,
Adrian

Phil Harvey

Hi Adrian,

Sorry, but the -ext option does not accept wildcards in its argument.

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

agill

Hi Phil,

Once again thanks for your continued vigilance and support, letting me know why my wild-card attempts didn't work with the ext option.

It's no "big deal" as I can list each ext type individually as I did with the --ext .jpg_original -- ext .cr2_original - exiftool remains for me an awesome tool, for which I'm VERY grateful! It has seriously revolutionized my ability to tag and organize photos - think I'm talking myself into a donation here! :)

Would it be feasible, and/or would you consider ever putting a wild card capability onto the ext option?
Certainly I'm in no hurry for such due to the perfectly workable ability to list each ext - after all, I don''t have THAT many different file types I'm dealing with  :D
I also have no idea if anyone else would want such, so if I'm the only person who's ever raised this, I seriously doubt it would be worth the trouble to put it in.

Anyway, my thanks as ever for this amazing tool, and your own amazing support.
I'm greatly enjoying working with it,
Adrian

Phil Harvey

Hi Adrian,

If you pass a directory name to ExifTool instead of individual file names then it won't process the "_original" files.

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

agill

Hi Phil,

Thanks for that tip, I tested it and it's v. useful as it means by setting up 2 Automator apps I can take care of what I need.

Great!
Thanks again,
Adrian