#删除5天前的备份 COUNTS=`ls /Backup|sort|wc -l` echo "There is $COUNTS files in /Backup..." >>$LOGFILE 2>&1 if [ $COUNTS -ge 7 ] then echo "An oldest file will be delete ,please wait..." >>$LOGFILE 2>&1 OLDFILE=`ls /Backup|sort|head -1` >>$LOGFILE 2>&1 cd /Backup rm -f $OLDFILE >>$LOGFILE 2>&1 echo "Delete file completed ,$OLDFILE was deleted." >>$LOGFILE 2>&1 else echo "There is no more then 6 file ,nothing to do..." >>$LOGFILE 2>&1 fi