#!/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
shell腳本(刪除7天之前的文件)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.