shell 获取不同目录下指定文件,并把文件复制到一个文件夹下面

resource_dir=/tmp/jobs20170711/jobs/*/config.xml
target_dir=/tmp/jobs20170711/bake
filelist=`ls $resource_dir`
for file in $filelist
do
res_file=`echo $file | awk -F "/" '{print $(NF-1)}'`
echo $res_file
echo $file
cp $file $target_dir$res_file".config.xml"
done

posted @ 2017-07-12 21:33  testway  阅读(4655)  评论(0编辑  收藏  举报