#!/bin/sh
echo "删除指定目录下result-order开头的文件,保留最新的5个"
report_dir='/Users/Shared/Jenkins/Home/workspace/pro_env_order'
save_num=5
cd $report_dir
save_file=`ls -lrt | grep 'result-order' | tail -$save_num | awk '{print $NF}'`
ls | grep 'result-order' | grep -v "$save_file" | xargs rm -rf