I'm using exiftool
to rename and organize the photos taken from a camera to a specified destination directory.
How can I specify the input source file name using regex?
Example:
I have a directory with these two files:
IMG_20160716_121830.jpg
IMG-20160716-121830-WA0004.jpg
I only want to process IMG_20160716_121830.jpg
As user @Borodin mentions, in your example you only want files that have an underscore, not a dash. In that case you just would search for files with an underscore.
But if that's a typo or if you need to recurse (wildcards don't work with exiftool's -r
recurse option, see Common mistake 2 & 3), then you can use exiftool's -if
option to do a regex match on the filename. In this case, you would add something like:
-if "$filename=~/IMG-\d{8}-\d{6}\.jpg/"
to you command (change double quotes to single quotes if on Mac/linux).