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

-- 
TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ  : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc

Reply via email to