#!/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 #還可以做過濾后刪除