Andreas Sikkema writes:
Hi
Is there a way to get procmail save mail to a folder with a date in
the name? I want procmail to save some mail to a folder that changes
it's name every month. Or do I need another app to do this?
I'm doing something similar: I run hypermail through procmail to
create html archives of some mailing lists:
:0 c:tetex.lock
* ^Sender: owner-tetex
| ${HYPERMAIL} -i -u -d ${ArchiveRoot}/teTeX/${MonthFolder} \
-l "teTeX ${DATE}" -a "${ArchiveRoot}/index.shtml" \
-b "${ArchiveRoot}/teTeX/info.html"
:0A:
IN.tetex
where DATE=`date '+%B %Y'` and MonthFolder=`date +%Y-%B`.
Note1: There are procmail recipes which extract date and time information
from email, thus saving the call to the 'date' command. Era's procmail
page has links to appropriate libraries.
I'm using GNU date because it's easier ;)
Note2: In this example, hypermail automatically creates ${MonthFolder}
(-d option) if it doesn't exist. There are also examples in the
procmailex man page.