#!/bin/bash
#date 0802
if [ ! -d './scripts' ];then
mkdir ./scripts
fi
rm -rf ./scripts/*
find ./ -regex ".*/.*\.\(sql\|dmp\)" >1.txt
i=1
cat 1.txt | while read li
do
dir_name=${li%/*}
dir_name=${dir_name##*/}
flag=`echo $dir_name |egrep '仅|执行'`
if [[ $flag ]];then
if [ ! -d ./scripts/${dir_name} ];then
mkdir ./scripts/${dir_name}
fi
cp "$li" "./scripts/${dir_name}/${i}_${li##*/}"
((++i))
else
cp "$li" "./scripts/${i}_${li##*/}"
((++i))
fi
done
rm -f 1.txt
网友评论