V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
jasonye
V2EX  ›  Linux

rsync 如何保留目标目录里的特定文件?

  •  
  •   jasonye · 2016-03-21 16:28:32 +08:00 · 2999 次点击
    这是一个创建于 2974 天前的主题,其中的信息可能已经有所发展或是发生改变。

    源目录 /a /b .gitignore .git

    目的目录 /b /d

    --delete --delete --exclude='.gitignore' --exclude='.git' 使用了这个参数的删除.gitignore 同时,保留 /d 目录?

    2 条回复    2016-03-21 17:13:52 +08:00
    kozora
        1
    kozora  
       2016-03-21 16:37:14 +08:00
    原理应该一样 git 不是太熟
    我是两台服务器 A B
    B 从 A 使用 rsync 同步,但是不同步日志文件过来
    在参数上使用 --exclude-from=/home/crontab/rsync_exclude.lst
    你要指定一定需要排除的目录 我存在 rsync_exclude.lst
    比如我不同步 Webphp/Runtime/下面的所有东西 就在 rsync_exclude.lst 填写 Webphp/Runtime/ 末尾一定要带上 /
    希望对你有帮助
    jasonye
        2
    jasonye  
    OP
       2016-03-21 17:13:52 +08:00
    找到解决方式。
    --exclude 同样适用于目的文件夹
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2772 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 11:05 · PVG 19:05 · LAX 04:05 · JFK 07:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.