#!/bin/sh # (C) Dinko Korunic, 2006. # quick hack to gather manually classified spam (e-mails) from different # users to be sa-learned later # requires clean-for-amavis script too. PATH=$HOME/bin:$PATH ## move from one maildir to another, keeping status function mvmaildir() { # $1 = src # $2 = dst if [ -z "$1" -o -z "$2" ]; then echo "Mising src or dst folder" return fi if [ ! -d "$1" ]; then echo "No such src folder: $1" return fi if [ ! -d "$2" ]; then echo "No such dst folder: $2" return fi find "$1/new" -type f -exec mv '{}' "$2/new" ';' find "$1/cur" -type f -exec mv '{}' "$2/cur" ';' } ## clean obsolete CRM and other headers and fix permissions function fixmail() { # $1 = src if [ -z "$1" ]; then echo "Mising src folder" fi find "$1/cur" -type f -exec clean-for-amavis '{}' ';' find "$1/new" -type f -exec clean-for-amavis '{}' ';' chown -Rh amavis:amavis $1 } AMAVIS=/var/lib/amavis/spam-maildir PAVLE="/home/pavle/Maildir/.spam" if [ -d $PAVLE ]; then mvmaildir $PAVLE $AMAVIS fi KRE="/home/kreator/Mail/spam" if [ -d $KRE ]; then mvmaildir $KRE $AMAVIS fi ICARUS="/home/icarus/Maildir/.Spam" if [ -d $ICARUS ]; then mvmaildir $ICARUS $AMAVIS fi fixmail $AMAVIS