#!/bin/bash ######################### #删除7天以前的文件 # #2019年6月15日18:12:26 # ######################### path=/opt/teach/shell/project/test/ find $path -type f -mtime +7 | xargs rm -rvf #find $path -type f -mtime +3 -exec rm -rvf {} \; #这里的{} 其实是将前面的结果套进去使用 \换行 ;结束一条命令 xargs以空格为定界符 #find常规用法 #find path -option -exec shll #找到名称以test开头的文件,而且列出大小 #find /opt -name "test*" -type f -exec ls -lh {} \; #找到3天以前的文件 find /opt -mtime +3 #找到3天之内的文件 find /opt -mtime -3 #找到3天以上4天之内的文件 find /opt -mtime 3 #找到大小超过15M的文件 find /opt -size 15m -type f