always_bcc = <users-email-address> |
always_bcc = bob@greengrocer.co.za |
always_bcc = bob |
bob: /var/archive/maildir/ |
# pwd /var/archive/maildir # find ./ -type d ./ ./tmp ./cur ./new |
STORE=/var/archive/maildir/new KEEP=/var/archive/keep DOMAIN=greengrocer.co.za for x in `find $STORE -type f` do echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" RSLT=`cat $x | grep "Return-Path"` PERSONTMP=`echo $RSLT | cut -f 2 -d "<"` PERSON=`echo $PERSONTMP | cut -f 1 -d ">"` echo "-checking email.. $x" echo "-get sender.. $PERSON" RSLT1=`echo $PERSON | grep -i -e "@$DOMAIN" 1> /dev/null ; echo $?` if [ "$RSLT1" == "0" ] then NAME=`echo $PERSON | cut -f 1 -d "@"` echo "-sender is a $DOMAIN person.. $NAME" if [ -d $KEEP/$NAME ] then echo "--archive folder exists" else echo "--archive folder does not exist .. so create it" mkdir $KEEP/$NAME fi echo "-so lets move the email.." mv -uv $x $KEEP/$NAME else echo "-sender is not a $DOMAIN person.." NAME=`echo $PERSON | cut -f 2 -d "@"` echo "-external senders domain is $NAME" if [ -d $KEEP/external.domains ] then echo "--archive folder exists" else echo "--archive folder does not exist .. so create it" mkdir $KEEP/external.domains fi echo "-so lets move the email.." mv -uv $x $KEEP/external.domains fi echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" done |
BSE=/var/archive/keep TMPF=/tmp/sort.f.lst TMPL=/tmp/sort.l.lst rm -rf $TMPF rm -rf $TMPL echo "-Get folder names.." for FLIST in `ls $BSE/` do echo -n "." echo $FLIST >> $TMPF done echo "" ; echo "" for x in `cat $TMPF` do rm -rf $TMPL echo "-lets do $x" cd $BSE/$x find ./ -type f -maxdepth 1 > $TMPL for y in `cat $TMPL` do echo $y FILEDATE=`date -r $y | gawk '{ print $1"-"$2$3"-"$6 }'` if [ -d $BSE/$x/$FILEDATE ] then echo "--folder exists" else echo "--folder does not exist..create it" mkdir $BSE/$x/$FILEDATE fi mv $BSE/$x/$y $BSE/$x/$FILEDATE done echo "" done echo "" |
# find ./lucy -type d ./lucy ./lucy/Tue-Jul18-2006 ./lucy/Wed-Jul26-2006 ./lucy/Thu-Jul27-2006 ./lucy/Wed-Jul19-2006 ./lucy/Mon-Jul17-2006 ./lucy/Thu-Jul20-2006 ./lucy/Fri-Jul21-2006 ./lucy/Mon-Jul24-2006 ./lucy/Tue-Jul25-2006 ./lucy/Fri-Jul14-2006 ./lucy/Fri-Jul28-2006 ./lucy/Mon-Jul31-2006 ./lucy/Wed-Aug2-2006 ./lucy/Tue-Aug1-2006 |