OT: Removal of old 14+ mail from mbox-based mail spool (not
matt at atopia.net
Wed Aug 17 15:58:44 GMT 2005
| Also, a script in sh(1), or do you have some other
> language available? I have a short PHP script
> that does something similar and could be modded,
> OTOH, somebody around here could probably
> give you a one-liner with sh, sed, grep, awk, date,
> test, etc., but I was at the hospital last night until
> 2 a.m. and don't think I can pull it off ATM....
> Kevin Kinsey
I want to clean out an IMAP "folder" (actually file $HOME/mail/Spam).
We have about 10,000 users and our users don't check their spam
quarantine often, so our policy is to remove messages after 14 days.
I know how to:
1) recursively pull each Spam folder in existance (for x in `ls
/home/*/mail/Spam`; do ....; done)
2) Use grep and awk to pull each message and its relative data (grep the
date, parse it)
What I'm not sure of is how to remove a message from the spool itself.
Should I just use grep and/or sed to "pull until new From header", then
remove those lines from the spool manually?
This would be easier if I could use IMAP, because then I could use the
built-in PHP functions for imap to check dates and remove messages.
Problem is, we don't know the user's passwords (they are hashed).
Any other ideas? Thanks!
More information about the freebsd-questions