Hi,
I would like to rename and move my Canon raw files in the way of:
D:\YYYY\MM\YYYY_MM_DD\<Initials>_YYYYMMDD_filenumber.extension: like
D:\2011\01\15\PHX_20110115_9776.CR2
I found the $filenumber tag of Canon. This says 297-9776. I would like to have only the last 4 digits.
I tried several but could not get the right result. Especially extracting the last 4 digits. I also could not find how to extract part of a string tag result
FAQ number 19 (https://exiftool.org/faq.html#Q19) may answer some of your questions (but after reading this you'll likely be back with others...).
- Phil
Hi Phil,
I tried the following, but do not get the right result.
The result I get is: DAH_20100903_${MyFileNumber}.CR2
This should be DAH_20100903_8345.CR2
I used the following command in a Windows batch file:
exiftool "-config ExifTool_config" "-filename<Createdate" -d "D:/Foto's/Test/%%Y%%m%%d/DAH_%%Y%%m%%d_${MyFileNumber}.%%%%e" "E:\Foto's\2010\09\2010_09_03\*.CR2"
The config file is named: .ExifTool_config
MyFileNumber should result the last 4 digits of 300-8345
It contains:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyFileNumber => {
Require => 'FileNumber',
ValueConv => '$val =~/(\d\d\d\d)$/; $val',
},
},
);
1; # end
In the makernotes filenumber is like: 300-8345
Whats do i wrong?
Very good. You nearly got it. Just one little change:
ValueConv => '$val =~/(\d\d\d\d)$/; $1',
The $1 represents the 1st expression in brackets (in this case, the 4 digits).
- Phil
Thanks. I corrected it, see this thread https://exiftool.org/forum/index.php/topic,3076.msg13837.html#msg13837 (https://exiftool.org/forum/index.php/topic,3076.msg13837.html#msg13837)