shell find 删除超过30天的文件和目录


#!/bin/bash 
location="/root/sqlbak/"  
find $location -mtime +30 -type d |xargs rm -rf   #删除目录
find $location -mtime +30 -type f |xargs rm -f   #删除文件
find $location -mtime +30 |xargs rm -rf   #删除目录及文件
find $location -mtime +30 -name "*.gz" | xargs rm -f #还可以做过滤后删除

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM