歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> 關於Unix

刪除vpopmail中N天之前信的腳本

剛剛學腳本:)第一個哦

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

Copyright © Linux教程網 All Rights Reserved