Hi all,
using exiftool I rename my files to the following structure:
YYYYMMDD_MODELL_####.EXT where
YYYY is the Year of the Createdate field
MM is the month of the createdate field
DD is the Day of the createdate field
_MODELL_ is the Cameramodell if taken the pictures with
#### is the original picture number and
EXT is the original Extension of the file (eg. 'NEF' or 'JPG')
this is done with this line of code:
%Exiftool%\exiftool.exe -config %Exiftool%\EXIF_CONFIG_FILE_US.CFG -r -d %%Y%%m%%d "-FileName<${createdate}_${myModel}_%%-4f%%-c.%%e" %EXPORTPath_JPG%
where
%Exiftool% is a variable for the path where the exiftool is placed and %EXPORTPath_JPG% is the path where I'd like to store the files.
after that, I move my files to a date based structure with this code line:
%Exiftool%\exiftool.exe -r -d "%TargetROOTPath%\%%%%e\%%Y\%%y-%%m\%%Y-%%m-%%d%%%%-c" "-Directory<createdate" %EXPORTPath_JPG%
where %TargetROOTPath% is the root path of the structure where I finally keep my files.
So, the resulting structure looks like:
\ROOTPATH\2013\2013-07\2013-07-18\
This works really!! fine, most of the times.
The exception is, when there is no {createdate} information in the file. This may happens when you don't set your cameras date field and (mostly) when you have scanned files in the source structure, too.
My question:
To make sure that I don't oversee some files and delete them by accidentally (because they are not moved to my target structure), I would be really great to have a default value for the {createdate} field, if it is not there. The default could be 1900-01-01 or even 0000-00-00. This would make sure that the files are processed and not skipped.
Does anybody know if this is possible ?
Thank's for advice
Ulrich
Hi Ulrich,
To answer your question, you can assign the filename first with a default value.
Also, you can write both Directory and FileName together by writing a full path to FileName.
So the BAT file could look something like this:
%Exiftool%\exiftool.exe -config %Exiftool%\EXIF_CONFIG_FILE_US.CFG -r -d %TargetROOTPath%\%%%%e\%%Y\%%Y-%%m\%%Y-%%m-%%d\%%Y%%m%%d "-FileName<%TargetROOTPath%\%%%%e\0000\0000-00\0000-00-00\00000000_${myModel}_%%-4f%%-c.%%e" "-FileName<${createdate}_${myModel}_%%-4f%%-c.%%e" %EXPORTPath_JPG%
- Phil
Great !!
Thank's your your very quick reply.
Hi Phil,
sorry, but I've got another question.
Your solution works fine, but still skippes some files.
Massage: "Warning: [minor] Tag 'myModel' not defined"
If the file does not contain the model field, the file is skipped and not processed.
This is the code for the MyModel field:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyModel => {
Require => 'Model',
# do translations and substitutions
ValueConv => q{
$val =~ tr{\\\/?*:|"<>}{}d;
$val =~ s/NIKON D200\b/N2/i;
$val =~ s/NIKON D7000\b/N7/i;
$val =~ s/NIKON D600\b/N6/i;
$val =~ s/u850SW,S850SW\b/O1/i;
$val =~ s/uT6010,ST6010\b/O2/i;
$val =~ s/DSC-P150\b/S1/i;
return $val;
},
},
},
);
1; #end
Is it possible to set a default value here as well ?
Ulrich
Hi Ulrich,
Yes. Just add another assignment with the default model to your command line, just like the CreateDate.
- Phil
Hi,
I tried this before I did my posting, but maybe I understood something wrong.
This was my guess:
%Exiftool%\exiftool.exe -config %Exiftool%\EXIF_CONFIG_FILE_US.CFG -r -d %TargetROOTPath%\%%%%e\%%Y\%%Y-%%m\%%Y-%%m-%%d\%%Y%%m%%d "-FileName<%TargetROOTPath%\%%%%e\0000\0000-00\0000-00-00\00000000_XX_%%-4f%%-c.%%e" "-FileName<${createdate}_${myModel}_%%-4f%%-c.%%e" %EXPORTPath_JPG%
The two 'XX' are in the default string instead of the myModel value. Unfortunately it doesn't work.
Ulrich
Hi Ulrich,
You need to use an "=", not a "<" this time because you aren't copying any tags.
- Phil
OK,
I understand.
Thank's again !