#!/bin/bash dir=`ls /root/123123/6*` for i in $dir do #basename 返回一个字符串参数的基本文件名称。(只剩下文件名除去路径名) a=`basename $i` cd /root/321321/ r=`find . -name "$a"` if [ "$r"x == "./$a"x ]; then continue else scp -r $i root@192.168.229.131:/root/321321 fi done
#!/bin/bash dir=`ls /root/123123/6*` for i in $dir do #basename 返回一个字符串参数的基本文件名称。(只剩下文件名除去路径名) a=`basename $i` cd /root/321321/ r=`find . -name "$a"` if [ "$r"x == "./$a"x ]; then continue else scp -r $i root@192.168.229.131:/root/321321 fi done