Rsync只是结构和指定的文件夹

丹尼尔·丹(Daniel Tan)

我的文件结构如下。

                     Sites
    --------------------------------------
    |                  |                 | 
    |                  |                 | 
    |                  |                 |
  Site 1              Site 2             Site3
 /      \            /     \            /     \
.git  dirX        .git    dirY        .git   dirZ
         |                  |                  |
         Config            Config            Config              

我只想复制文件夹结构,.git及其内容以及仅配置。我试过将rsync与include和exclude参数一起使用,但是没有运气。该命令立即完成

$ rsync -avz --exclude='*' --include='*/.git' --include='*/Config'  Sites/ newDIR/
麦克斯

我将rsync与“ declare”命令一起使用->就像一个魅力一样!!!声明的目录中的所有内容都将递归同步。

declare -a DIRS=("/etc /home /mnt /root /usr /var") # Which dirs to sync
sudo rsync -zaP $DIRS user@host:/path/to/folder --delete

对于排除...,我看到了一个可行的解决方案,它看起来与此类似:

rsync -arvzP --exclude=.ccache --exclude=build source dest

一次多个排除->这应该起作用!

也许这有帮助...

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章