模拟日志输出:
for n in `seq 14`
dodate -s “01/0$n/15”touch myfile_`(date+%F)`.log
done
date -s "01/14/15"
删除文件
find /app/logs/ -type f -mtime +7 | xargs rm -f
删除目录
find /app/logs/ -type d -mtime +7 | xargs rm -f
推荐方法:
find /app/logs/ -name "*.log" -mtime +7 | xargs rm -f