shell脚本删除特定时间的备份文件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#author admin@zhizhi123.com
#欢迎访问 back.zhizhi123.com
#!/bin/sh
backup_dir=/alidata/www/sh/useful-shell-script/www/
RegExp='*_bak_*'
day=-5
rmbackup()
{
    filelist=`find $1 -type f -name $2 -mtime $3`
    for file in $filelist
    do 
        echo '正在删除备份文件'$file
        rm -f $file
    done
    echo '删除完成'
}
rmbackup $backup_dir $RegExp $day