At 04:12 PM 11/12/97 +0100, Andreas Sikkema wrote:
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?
In your .procmailrc before you start recipes:
# Check man date for formatting info. This is YYYYMM format. To add DD (day)
# to the end, append %d to the format string
# this makes the directory if it doesn't already exist
DUMMY=`test -d $MAILDIR || mkdir $MAILDIR`
(MAILDIR defines the "current directory" while procmail is executing, so
where you specify a file without giving a path, this is where it expects to
find or put it. However, I'm fond of explicity declaring directory
variables everywhere I use a path to make things really clear in the script).
Now, when mail comes in, and you output it to a file, it'll be in a YYYYMM
(say $HOME/Mail/199711/) path. You still can have separate mailboxes
there. If you instead want a date-named mailbox, then you can omit the
DUMMY (mkdir) line, define MAILDIR normally, and then define something like:
Then explicitly use the $DATEBOX variable on the delivery line, like so:
* some rule
Since I filter into multiple folders, if I used something like this, I'd be
prone to use the directory method myself.
Please DO NOT carbon me on list replies. I'll get my copy from the list.
Sean B. Straw / Professional Software Engineering
Post Box 2395 / San Rafael, CA 94912-2395