[[言語関連]]
目次~
*概要 [#s735a211]
変数で指定した世代の管理を行う方法

*サンプル [#v42d81c8]
**ファイルのタイムスタンプを参照する方式 [#ub17d2ec]
 # Number of generations
 GEN="5"
 cd ${DIR}
 ls -1rt | head -n -${GEN} | xargs rm -rf
 
**ファイル名を参照する方式 [#y9296b25]
 # Number of generations
 GEN="5"
 cd ${DIR}
 ls -1 | head -n -${GEN} | xargs rm -rf

**削除対象のファイルをログに出力する [#d446091f]
 # Number of generations
 GEN="5"
 cd ${DIR}
 echo $(date '+[%Y/%m/%d %H:%M:%S]') ":[INFO] Delete old files. ( "`ls -1rt | head -n -${GEN} | awk '{printf "%s ",$1}'`")" >> $LOGFILE



トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS