分类:
2010-09-03 17:57:48
#!/bin/bash
DelDateFile=`date -d '-10 day' +%Y-%m-%d`
DirN=(/opt/dicc/logs /opt/dicc/jboss4.0.5.ccr/server/default/log )
for DirName in ${DirN[@]}
do
find $DirName -type f|grep $DelDateFile > /tmp/DelLogFile
if [ ! -f /tmp/DelLogFile ]
then exit 1
fi
for FileName in `cat /tmp/DelLogFile`
do
rm -rf $FileName
done
done
#要删除的文件名和要DelDateFile有匹配字符串
chinaunix网友2010-09-06 14:40:17
Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com