加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell脚本查询某一目录的某一部分文件并且拷贝到其他目录(有则

发布时间:2020-12-16 01:55:40 所属栏目:安全 来源:网络整理
导读:#!/bin/ bashdir =`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
#!/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 [email?protected]192.168.229.131:/root/321321
    fi
done

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读