Create filename (sub)string based on a tag mapping?

Started by LookTouch Photo, September 25, 2020, 01:52:39 PM

Previous topic - Next topic

LookTouch Photo

I am copying files with this command (OS W10)

exiftool -d "\%Y\%m\%d_%H%M_%S" "-filename<targetdir${createdate}${FileSequence;$_%=100;$_=sprintf('%02d',$_ )}_C5.%e" "sourcedir"

This created files e.g. 
21_1536_2905_C5.ARW
21_1537_5506_C5.CR2
21_1538_0107_C5.JPG
etc.

(of course in directory 2020\09\)

Is it possible to dynamically assign the _C5 part (aka CamID) based on the value of the -model tag and a mapping table ?
For example:

-model tag               CamID
EOS-1Ds Mark III   _C2
ILCE-7RM3             _C5
Nexus 6P               _C6

Desired result:
21_1536_2905_C5.ARW
21_1537_5506_C2.CR2
21_1538_0107_C6.JPG

Currently I am using a workaround based on multiple calls to exiftool with e.g. -if "$Model = 'ILCE-7RM3'" and hardcoding the CamID, in this case  "_C5" in the command.

Bonus challenge :-)
For unknown models (tag value not in the table) _XX should be assigned.
OS Windows10

Phil Harvey

There are a number of threads discussing this already.  Here is one.

In your case you would use:

            OTHER => sub { return "XX" },

- 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 ($).

LookTouch Photo

Thanks for the pointer! And for creating such a powerful tool!
OS Windows10