作成
N日・N分より前の 古い・新しいファイルを検索・削除
###center すぐ忘れるので、メモw ###title find の基本 ###memo -mtime や -mmin で 日・分を指定してファイルの一覧が取得できます。 ###command (現在~10日前 *新しいファイルを検索) find ./ -mtime -10 ###command (10日前~過去 *古いファイルを検索) find ./ -mtime +10 ###command (ジャスト10日前) find ./ -mtime 10 ###command (/tmp フォルダを対象に 10日前~過去) find /tmp -mtime +10 ###title3 ちょっと応用(10日前~過去) ###memo find ~ type -f | xargs ls ~ をつけます。 type -f を忘れるとダメっぽいです。 ###command (10日前~過去 のファイル) find ./ -mtime +10 -type f | xargs ls -lt ###command (10日前~過去 の jpgファイル を 新しい順) find ./ -mtime +10 -name "*.jpg" -type f | xargs ls -lt ###command (10日前~過去 の jpgファイル を 古い順) find ./ -mtime +10 -name "*.jpg" -type f | xargs ls -ltr ###title 10日以上前の JPGファイルを削除 ###error ls で確認してから、 rm するようにしましょう・・・。 -type f を忘れると全ファイル削除などなりかねないので・・・・ ###command (怖いので確認・・・) find ./ -mtime +10 -name "*.jpg" -type f | xargs ls -lt ###command (10日前~過去 の jpgファイル 削除!) find ./ -mtime +10 -name "*.jpg" -type f | xargs rm -rf ###title パラメーターなど ###title3 find ###memo find -mtime は日時指定 find -mmin は分指定 find -type f は ファイルのみ ###title3 ls ###memo ls -lt 更新日時の新しいもの順 ls -ltr 更新日時が古いもの順
wakatta 記法
投稿の仕方
基本的な記法
エンジニア向け記法
記法のサンプル
このコンテンツを見る