Hi
First of all, thank you for this fantastic tool.
My concern is to add the LensModel to my filenames
For that I execute
exiftool '-filename<%f_${LensModel}.%e' .
The expected result is a filename like
"myfilename_EF-S18-55mm f/3.5-5.6 IS"
Instead of this the command creates a directory
myfilename_EF-S18-55mm f
and puts in this directory the file
3.5-5.6 IS
I understand what happens : the substring "f/" (not sure it is a /) should mean "create a directory"
How to avoid this behavior ?
Thanks
Sorry I remembered that I made the change (a long time ago !) for this to work.
I defined a MyLensModel in the file .Exiftool_config
For those who are concerned here is the list of the config file
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyShutterSpeedValue => {
Require => 'ShutterSpeedValue',
ValueConv => '$prt[0] =~ tr/\// /; $prt[0]',
},
MyLensModel => {
Require => 'LensModel',
ValueConv => '$prt[0] =~ tr/\// /; $prt[0]',
},
}
)
Yes. The user-defined tags were the only solution at one time.
But as of ExifTool 9.15, you can also do this on the command line:
exiftool '-filename<%f_${LensModel;tr(/)( )}.%e' .
Here I have used different delimiters for tr to avoid the problem of having to escape the backslash that would have been needed to escape the slash.
- Phil
Great news !
I will soon use this new feature.
Thanks
Another question about this new syntax.
The tr() function is useful to change characters.
Is there a function to change strings ?
For exemple the ${model} tag returns something like
Canon EOS 5D Mark II
I would like to change this to
5DMKII
Of course I have a solution outside of exiftool (Ant Renamer for example) but it would be great to do this in the same exiftool command
Thank you in advance
Quote from: carella on April 09, 2013, 04:34:19 AM
Is there a function to change strings ?
Yes.
s(Canon EOS 5D Mark II)(5DMKII)s = substitute
tr = translate
Google "Perl regular expressions" for more details.
- Phil