procmail
[Top] [All Lists]

Re: Monthly cleanup/archiving?

2002-02-11 04:41:12

On Sun, 10 Feb 2002, Tim Hogan wrote:

[...]

When I delete my mail it goes to my Trash mailbox which is one large file.
I would like to be able to have a cron job run that once a month would
filter all of the mail in the Trash folder and take all of the message with
last months date or older and put them in a new file called archive/{month}
{year}.  For example if I ran the filter now it would look in my Trash file
and take all of the messages for last month and put them in a file called
~/mail/archive/jan2002 and remove them from the Trash folder.  Can ProcMail
do this?  If so how do I do this?

Thanks
Tim

        
        You can find in the FAQ an answer about and it is not simple.
        I am too lazy to try understand it - SO, here is my solution:

Prompt#  cat .procmailrc
[...]

DATE=`date '+%y%m%d%H%M'`

[...]

#  The last recipe
:0 fw
| /usr/bin/formail -b -a"X-T-Stamp: $DATE" -a"X-Loop: AntiloopA"


        (ignore the X-Loop, its another story) The Header line looks
        like this:

[...]
X-T-Stamp: 0202111321


        Now, you can play with reg` to fined out what ever you want:

Prompt# cat clean-example
[...]

:0 H
* X-T-Stamp: 0202110[0-9]+
/dev/null


        See the man page procmail(1) to find example for script which
        show howto lock and update the folder from crontab. (it is in
        the NOTES section)

Bye,
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>