[Originally posted by exiftool on 2009-09-17 11:04:46-07]OK, I'm on a keyboard now. You can do what you want
with this command line:
exiftool "-rights<Copyright $myyear" "-title<mytitle" "-creator<myauthor" DIR
(where
DIR is the directory containing the images). Note that
you must use single quotes instead of double quotes around the argument
containing a dollar sign ($) if you are running on a Mac or Linux. Here I have
assumed that you want to write this information to XMP, but you can
of course change the command to write whatever tags you want.
And here is the config file you need to define the "My" tags:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyYear => {
Require => 'FileName',
ValueConv => '$val=~/\[(.*)\]\s*(.*?)\s*\((.*)\)/; $1',
},
MyTitle => {
Require => 'FileName',
ValueConv => '$val=~/\[(.*)\]\s*(.*?)\s*\((.*)\)/; $2',
},
MyAuthor => {
Require => 'FileName',
ValueConv => '$val=~/\[(.*)\]\s*(.*?)\s*\((.*)\)/; $3',
},
},
);
1; #end
The command will only add metadata to files with names that match
the format you specified. See the
config
file documentation for instructions on how to use the config file.
The tricky part here (from a non Perl programmer point of view)
is the expression in the ValueConv definition above which pulls the
required information from the filename string.
- Phil