#!/bin/bash #date:2017-04-11 #version:clear_ballcloud_back_v1.0 #contents:removingthe/www/web/ballcloud_bakck/*,ifthefileiscreatedabove32day # cd/www/web #sumthesizeofalreadydeletedirectory dirsize=`du-sbackup_ballcloud|awk'{print$1}'` # #definethereadytodeldirectory # maxsize=$((20000)) cleardir="/www/web/backup_ballcloud" echo-e"Allowdmaxsize:$maxsize\n"; # #deleteallof/www/web/ballcloud_back/* # if[$dirsize-gt$maxsize];then cd$cleardir&&find.-mtime+32-typed|xargsrm-rf&>/dev/null; fi # #DefinemptyFolder=`ls/www/web/backup_ballcloud|wc-l` # emptyFolder=`ls/www/web/backup_ballcloud|wc-l` if[$emptyFolder-gt0];then cd$cleardir&&find.-mtime+32-typed|xargsrm-rf&>/dev/null; fi
#
原文链接:https://www.f2er.com/bash/392686.html