Shell Script Rollup 2 delete files that have been created for more than 32 days

Source: Internet
Author: User

Shell Script Rollup 2 delete files that have been created for more than 32 days


#!/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 directorydirsize= ' 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  ];thencd  $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


#

This article is from the "Frog Technology Archive" blog, so be sure to keep this source http://frogtwo.blog.51cto.com/3805708/1937267

Shell Script Rollup 2 delete files that have been created for more than 32 days

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.