#保留每月1号 每周一 7天内
cd $backPath
filelist=`ls $backPath/`
for f in $filelist
do
filename=$f
cutfile=`echo $filename |cut -c1-3`
cuttime=''
if [ "$cutfile" = "saf" ]; then
cuttime=`echo $filename |cut -c7-14`
elif [ "$cutfile" = "upl" ]; then
cuttime=`echo $filename |cut -c11-18`
else
echo ""
fi
chuyi=`echo $cuttime |cut -c7-8`
if [ "$chuyi" = "01" ]; then
echo $filename'chuyi======'
continue
fi
xinqi=`date -d $cuttime +%w`
if [ "$xinqi" = "1" ]; then
echo $filename'xinqiyi===='
continue
fi
sevenday=`date -d '-7 day' +%Y%m%d`
if [ "$cuttime" -gt "$sevenday" ]; then
echo $filename'serverday======'
continue
fi
rm -rf $backPath/$filename
done
cd $backPath
filelist=`ls $backPath/`
for f in $filelist
do
filename=$f
cutfile=`echo $filename |cut -c1-3`
cuttime=''
if [ "$cutfile" = "saf" ]; then
cuttime=`echo $filename |cut -c7-14`
elif [ "$cutfile" = "upl" ]; then
cuttime=`echo $filename |cut -c11-18`
else
echo ""
fi
chuyi=`echo $cuttime |cut -c7-8`
if [ "$chuyi" = "01" ]; then
echo $filename'chuyi======'
continue
fi
xinqi=`date -d $cuttime +%w`
if [ "$xinqi" = "1" ]; then
echo $filename'xinqiyi===='
continue
fi
sevenday=`date -d '-7 day' +%Y%m%d`
if [ "$cuttime" -gt "$sevenday" ]; then
echo $filename'serverday======'
continue
fi
rm -rf $backPath/$filename
done