shell find and rm

时间:2023-03-10 05:24:52
shell  find and rm
按时间删除命令:

删除当前目录下30天以前的所有文件:
find . -type f -ctime + -exec rm -fr {} \; 删除当前目录下30天以前的所有目录:
find . -type d -ctime + -exec rm -fr {} \; 删除/oracle/123目录下3天以前的文件:
find /oracle/ -type f -ctime + -exec rm -rf {}\ ; 删除当前目录下30天以前,名称匹配"*awr*.html"的文件:
find . -type f -name "*awr*.html" -ctime + -exec rm -fr {} \;