|
藍森林 http://www.lslnet.com 2006年6月26日 11:18
請教按時間順序排列並刪除超出範圍的文件的方法
oracle的archive log會不斷有新的日誌產生
想定期保留最後按照日期產生的50個日誌,其餘刪除
或定期保留最近1個禮拜的產生的日誌,其餘刪除
ls -lrt |tail -n 50 顯示的就是不要被刪除的文件
這個文件夾下的其他文件被刪除 |
請教按時間順序排列並刪除超出範圍的文件的方法
simplest method is use find
#find /oracle_archive_path -type f -mtime +7 -exec rm {} \;
this command will remove whatever files that are older than one week in /oracle_archive_path directory |
請教按時間順序排列並刪除超出範圍的文件的方法
非常感謝 |
| |