2011年06月23日
Tweet
前に書いたと思ったのですが、見つからなかったのでメモ。
linux で○日以上前のファイルを削除したいという事がありました。
http://developer.unlax.com/2010/07/linux7.html
Linux コマンドで7日以上経過しているファイルを削除する
find . -type f -mtime +7 -print -exec rm -f {} \;
いまさらxargsの便利さを主張してみる
"find" n日前より古いファイルをまとめて削除 @LCD -Linux Command
find /root/test/ -mtime +2 -exec rm -f {} \;
find コマンドの -mtime は +1 でも2日前のファイルが対象
くれぐれも削除は慎重に。
※2012-07-17 追記
mv コマンドに渡す場合、 linux の場合には、 -i オプションを利用します。
find-xargsでmvやcpに引数を渡す方法

linux で○日以上前のファイルを削除したいという事がありました。
http://developer.unlax.com/2010/07/linux7.html
Linux コマンドで7日以上経過しているファイルを削除する
find . -type f -mtime +7 -print -exec rm -f {} \;
いまさらxargsの便利さを主張してみる
"find" n日前より古いファイルをまとめて削除 @LCD -Linux Command
find /root/test/ -mtime +2 -exec rm -f {} \;
find コマンドの -mtime は +1 でも2日前のファイルが対象
くれぐれも削除は慎重に。
※2012-07-17 追記
mv コマンドに渡す場合、 linux の場合には、 -i オプションを利用します。
find-xargsでmvやcpに引数を渡す方法