您的位置:首页 > 运维架构 > Shell

shell find and rm

2015-09-16 14:24 603 查看
按时间删除命令:

删除当前目录下30天以前的所有文件:
find . -type f -ctime +30 -exec rm -fr {} \;

删除当前目录下30天以前的所有目录:
find . -type d -ctime +30 -exec rm -fr {} \;

删除/oracle/123目录下3天以前的文件:
find /oracle/123 -type f -ctime +3 -exec rm -rf {}\ ;

删除当前目录下30天以前,名称匹配"*awr*.html"的文件:
find . -type f -name "*awr*.html" -ctime +30 -exec rm -fr {} \;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: