#!/bin/sh
SYSLOG=/home/neo/findtest/syslog
APPLOG=/home/neo/findtest/applog
for LOG in $SYSLOG $APPLOG ; do
var=`find $LOG -maxdepth 1 -type d | awk '{if(NR>1) print}' | wc -l` > /dev/null
if [ $var -ne 0 ] ; then
arr=(`find $LOG -maxdepth 1 -type d | awk '{if(NR>1)print}'`)
rm -rf $(find $LOG -maxdepth 1 -type d | awk '{if(NR>1)print}')
for((i=0;i echo "rm ${arr[i]} directory ok."
done
echo "at" `date +%Y-%m-%d-%H-%M-%S` "all rm ok."
echo -e "\n\n"
else
echo "at $LOG under no directory."
echo -e "\n\n"
fi
done
exit 0
阅读(1089) | 评论(1) | 转发(0) |