作者: zhouer ( ) 看板: Einstein 標題: [chat] about find(1) 時間: Wed Nov 20 22:37:49 2002 ※ 引述《xeon (Access Denied)》之銘言: > Please tell me the better way to: > ls | sort | head -n xxx | awk '{print "rm -rf " $1'} | sh ^^ 這是錯的, 要也是 ls -t > I wanna delete some files older than someday. 正規解法應該用 find path -Xtime (+)N -delete X 應該代換成: a -> the file last access time (access 也就是說, 讀取也算) c -> the time of last change of file status information (例如 chmod) m -> the file last modification time (例如 touch 或是 edit) (+)N 應該替換成: N -> N 天內 +N -> N 天以上 例: home 目錄中, 一天內存取過的檔案: find ~ -atime 1 刪去目前目錄中, 三天以上沒有修改過的檔案: find . -mtime +3 -delete -- ╭── Origin ╮ 動力核心  processor.tfcis.org  ∼ αβγ ──┼ ┼ Author ╯ 140.115.26.40