[TriLUG] command line: delete all mail in a folder

Michael Hrivnak mhrivnak at triad.rr.com
Tue Sep 30 01:07:40 EDT 2003


I am looking for the best way to delete all the mail in an mbox folder
from the command line.
 
Explanation:
 
I have spamassassin scan all incoming mail, which is then stored on an
imap server.  Tagged spam gets filtered by the client and moved to a
holding directory.  I can then glance over the spam before moving it
into the confirmed spam directory.
 
Once I make sure that it's all spam, I use "spamassassin -r" paired with
formail to report each message to Razor2 and run it through the bayesian
filters.  I want to create a cron job to periodically report all the
confirmed spam and then delete it.  This way I can continue to dump spam
into the confirmed folder throughout the day and let the server dispose
of it automatically.  Reporting I can do; deleting is a little trickier.
 
I've considered just deleting the entire file and using "touch" to
recreate an empty mbox folder, but there must be a more elegant and safe
way.
 
Thanks for your advice!
 
Michael Hrivnak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030930/e9ac2938/attachment.html>


More information about the TriLUG mailing list