#!/bin/sh
maildir="/home/vpopmail/domains/xxx.com"
tmp="/tmp"
for loop in `ls -l $maildir |grep ^d|awk '{if(!~/\./) print }'`
do
#find $maildir/$loop -mtime +1 -depth -exec rm -rf {} \;
find $maildir/$loop -type f -mtime +3 -depth -print >>$tmp/log
done
#for some important files
grep -v -E ".qmail|lastauth|maildirsize" $tmp/log >>$tmp/log1
while read file
do
#echo $file
rm -rf $file
done <$tmp/log1
rm -rf $tmp/log*