I want to:

- Get all mail reported as spam and feed it to dspam to learn as spam
- Get all mail reported as ham and feed it to dspam to learn as ham
- Purge my known spam folder of spam older than 7 days

I've been doing this manually about once every couple weeks. I figured it was time to write some scripts to do this nightly.

Here's a bash script I came up with. Before I set this loose I thought I'd ask if the syntax here looks correct. I replaced the cat $i lines with echo $i and things looked ok, but I'm used to seeing these on the command line with semicolons between each part... eg:
    for i in * ; do cat $i | dspam ... ; done

Thanks for any comments.  :)

-Rob

#!/bin/sh
SPAMDIR="/home/rob/.maildir/.zReport-Spam/cur"
HAMDIR="/home/rob/.maildir/.zReport-Ham/cur"

# Learn Spam
for i in $SPAMDIR/*
do
  cat $i | dspam --user rob --class=spam --source=error
done

# Learn Ham
for i in $HAMDIR/*
do
  cat $i | dspam --user rob --class=innocent --source=corpus
done

# Purge SPAM folder of messages older than 1 week
find ~/.maildir/.SPAM/cur -mtime +7 -exec rm {} \;
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to