?把源文件夹里面不存在于目标文件夹的文件/文件夹复制到目标文件夹
# 源文件夹
yuan="/home/ly/nginx-module-vts-0.1.18"
# 目标文件夹
mubiao="/home/ly/nginx2_test"
echo "===> ~~~~~~~~~~~~~~~~【start】~~~~~~~~~~~~~~~~ <==="
ys=`ls $yuan|wc -l`
ms=`ls $mubiao|wc -l`
echo "更新前数量: (源)$yuan:[$ys], (目标)$mubiao:[$ms]"
now=`date -d "now" +"%Y-%m-%d %H:%M:%S"`
echo "------$now------" >> 更新记录.txt
for a in $(ls $yuan)
do
if ! test -e $mubiao/$a; then
cp -r $yuan/$a $mubiao
echo "$now $a" >> 更新记录.txt
fi
done
ys=`ls $yuan|wc -l`
ms=`ls $mubiao|wc -l`
echo "---------------------------------------"
echo "更新后数量: (源)$yuan:[$ys], (目标)$mubiao:[$ms]"
echo "===> ~~~~~~~~~~~~~~~~【end】~~~~~~~~~~~~~~~~ <==="