shell脚本--定时导出文件分组
作者:
w_dll | 来源:发表于
2019-08-29 07:09 被阅读0次#!/bin/bash
#email gqoyvf@163.com
export LANG="en_US.UTF"
this_date=`date +%y%m%d`
cd /home/sonar_pdf
if [ ! -d "/home/sonar_pdf/${this_date}" ];then
mkdir ${this_date}
fi
find /var/lib/jenkins/workspace -type f -name "*.pdf" -exec mv -f {} /home/sonar_pdf/${this_date} \;
cd /home/sonar_pdf/${this_date}
find ./ -maxdepth 1 -name "*.pdf">this_pdf.txt
cat this_pdf.txt|while read li
do
this_dir=${li##*_}
this_dir=${this_dir%.*}
if [[ -z "$this_dir" ]];then
if [[ ! -d "undef" ]];then
mkdir undef
fi
mv -f $li ./undef
else
if [[ ! -d "$this_dir" ]];then
mkdir $this_dir
fi
mv -f $li $this_dir
fi
done
rm -f this_pdf.txt
if [ ! -d "/home/sonar_pdf/logs" ];then
mkdir /home/sonar_pdf/logs
fi
cd /home/sonar_pdf/logs
echo "`date` running successfully!">>01_import.log
本文标题:shell脚本--定时导出文件分组
本文链接:https://www.haomeiwen.com/subject/bikbectx.html
网友评论