OT: Removal of old 14+ mail from mbox-based mail spool (not maildir)

Kevin Kinsey kdk at daleco.biz
Wed Aug 17 15:17:36 GMT 2005

Matt Juszczak wrote:

> Hi all,
> Sorry this is off topic, just didn't really know where else to post 
> this other
> than to fellow sys-admins.
> I need a script that will analyze a mail spool file and remove email 
> from it
> that is more than 14 days old.  I found a couple; however, they 
> require perl
> modules I couldn't seem to find. Does anyone have any ideas?  If not, 
> I'll go
> ahead and write one.
> Thanks!
> -Matt

"mail spool file" being /var/mail/someuser?  Or do you
mean dead mail in the /var/spool/mqueue *directory*?
Technically the "mail spool" is a directory full of
individuals files, as I understand it....

I'd think cleaning out a directory to be easier, but
it isn't clear to me what you want.

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

More information about the freebsd-questions mailing list