删除vpopmail中N天之前信的脚本

发表于:2007-07-04来源:作者:点击数: 标签:
刚刚学脚本:)第一个哦

#!/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*

原文转自:http://www.ltesting.net