4 added 4 characters in body
source | link

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*at.*?)(?: #\d+)?\.jpg$/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*.jpg

(you may have to install the Date::Manip perl module).

The -Tag<value sets the corresponding tag. The ${tag;perl-code} can be used to expand to the value of tag after it has been processed by the perl-code.

Here, the plan is to use Date::Manip's UnixDate function to parse the date in the filename and convert it to a format acceptable for the CreateDate tag (2011-04-15 21:38:00).

Date::Manip understands a lot of common date formats. For instance, it understands 3-09-12 at 9:24 PM (though you have to tell it whether it's the US or non-US convention where the day or month is first) and 2010-09-15 at 18.44 (note the : instead of .).

So what we do is extract that part from the filename, convert the . to : and pass it to UnixDate.

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*at.*?)(?: #\d+)?\.jpg$/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*.jpg

(you may have to install the Date::Manip perl module).

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*at.*?)(?: #\d+)?\.jpg$/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*.jpg

(you may have to install the Date::Manip perl module).

The -Tag<value sets the corresponding tag. The ${tag;perl-code} can be used to expand to the value of tag after it has been processed by the perl-code.

Here, the plan is to use Date::Manip's UnixDate function to parse the date in the filename and convert it to a format acceptable for the CreateDate tag (2011-04-15 21:38:00).

Date::Manip understands a lot of common date formats. For instance, it understands 3-09-12 at 9:24 PM (though you have to tell it whether it's the US or non-US convention where the day or month is first) and 2010-09-15 at 18.44 (note the : instead of .).

So what we do is extract that part from the filename, convert the . to : and pass it to UnixDate.

3 added 4 characters in body
source | link

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*?at*at.*?[AP]M)(?: #\d+)?\.jpg$/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*[PA]M**at*.jpg

(you may have to install the Date::Manip perl module).

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*?at.*?[AP]M)/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*[PA]M*.jpg

(you may have to install the Date::Manip perl module).

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*at.*?)(?: #\d+)?\.jpg$/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*.jpg

(you may have to install the Date::Manip perl module).

2 deleted 15 characters in body
source | link

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*?at.*?[AP]M)/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*[PA]M*.jpg

(you may have to install the Date::Manip perl module. That assumes US style dates, see the Date::Manip manual if you mean non-US dates).

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      /on (.*?at.*?[AP]M)/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*[PA]M*.jpg

(you may have to install the Date::Manip module. That assumes US style dates, see the Date::Manip manual if you mean non-US dates.

Try:

exiftool '-CreateDate<${FileName;use Date::Manip;
                      Date_Init("DateFormat=non-US");
                      /on (.*?at.*?[AP]M)/;$_=$1;
                      y/./:/;$_=UnixDate($_,"%Y-%m-%d %T")
                      }' ./*on\ *at*[PA]M*.jpg

(you may have to install the Date::Manip perl module).

1
source | link