Sure, you can do it quite easily with the exiv2 utility and some shell scripting on a *nix system.
Supposing you are in the directory containing the file you can do something like this:
for pic in *.jpg ; do
date = $( echo $pic | cut -d. -f1 | cut -d_ -f2-3 )
exiv2 -M"set Exif.Image.DateTime Ascii $date" $pic
done
This will store a "date_time" string in the DateTime
field of the image. As you can see, the Exif.Image.DateTime
field accepts an ASCII string, so you can do whatever processing you want to get a better looking date. In your example, the field would then contain the string 20130326_232320
, but you can do pretty much whatever you want with a bit of parsing.
A (maybe better, depending on your needs) alternative to EXIF is using the IPTC format and the corresponding IPTC.Date
and IPTC.Time
fields, which requires a specific data format but are easier to understand by photo management programs.
The exiv2
man page specifies that the IPTC.Date
format is YYYY-MM-DD
, while the IPTC.Time
format is HH:MM:SS+|-HH:MM
(local hour plus local offset from UTC). You can set them in the same way, but it will require a bit more filename parsing, of course.
The exiv2
tool is also available for Windows, so if you know a bit of batch scripting it shouldn't be too hard to implement it there.