shell脚本汇总 2 删除创建时间超过32天的文件
#!/bin/bash #date:2017-04-11 #version:clear_ballcloud_back_v1.0 #contents: removing the /www/web/ballcloud_bakck/* , if the file is created above 32 day # cd /www/web #sum the size of already delete directory dirsize=`du -s backup_ballcloud | awk ‘{print $1 }‘ ` # #define the ready to del directory # maxsize=$((20000)) cleardir="/www/web/backup_ballcloud" echo -e "Allowd maxsize:$maxsize \n" ; # # delete all of /www/web/ballcloud_back/* # if [ $dirsize -gt $maxsize ];then cd $cleardir && find . -mtime +32 -type d | xargs rm -rf &> /dev/null; fi # #Defin emptyFolder= `ls /www/web/backup_ballcloud | wc -l ` # emptyFolder=` ls /www/web/backup_ballcloud | wc -l ` if [ $emptyFolder -gt 0 ];then cd $cleardir && find . -mtime +32 -type d | xargs rm -rf &> /dev/null; fi
#
时间: 2024-10-24 06:03:09