zoukankan      html  css  js  c++  java
  • rsync源目录写法的一点小细节

    原始状态:

    [root@localhost tmp]# tree
    
    .
    
    ├── a
    
    │   ├── a1
    
    │   └── a2
    
    └── b
    
     
    
    2 directories, 2 files
    
     
    
    [root@localhost tmp]# rsync -av --progress a b
    
    sending incremental file list
    
    a/
    
    a/a1
    
               0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=1/3)
    
    a/a2
    
               0 100%    0.00kB/s    0:00:00 (xfer#2, to-check=0/3)
    
     
    
    sent 143 bytes  received 54 bytes  394.00 bytes/sec
    
     
    
    [root@localhost tmp]# tree
    
    .
    
    ├── a
    
    │   ├── a1
    
    │   └── a2
    
    └── b
    
        └── a
    
            ├── a1
    
            └── a2

    回到原始状态:

    注意,源目录多了一个斜杆:

    [root@localhost tmp]# rsync -av --progress a/ b
    
    sending incremental file list
    
    ./
    
    a1
    
               0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=1/3)
    
    a2
    
               0 100%    0.00kB/s    0:00:00 (xfer#2, to-check=0/3)
    
     
    
    sent 133 bytes  received 53 bytes  372.00 bytes/sec
    
    total size is 0  speedup is 0.00
    
    [root@localhost tmp]# tree
    
    .
    
    ├── a
    
    │   ├── a1
    
    │   └── a2
    
    └── b
    
        ├── a1
    
        └── a2
    
     
    
    2 directories, 4 files

    变成了a下面的内容复制到文件b下,而不是像第一次的包括a整个目录

    目标如果是文件夹的话,最后有没有加斜杆都不影响。

    加-n参数可以进行dry-run模式,即只显示有可能的改变,但实际并不执行。

  • 相关阅读:
    Android按钮事件的4种写法
    VB.NET转C#代码的工具
    C# FTP操作类
    Linq一对多联合查询
    软件工程师面试题(一)
    一道网传上海幼儿园升小学的数学题
    csdn博客刷点击率(java代码)
    .NET高端职位招聘要求
    csdn博客刷粉代码
    jQuery Ajax无刷新操作
  • 原文地址:https://www.cnblogs.com/zejin2008/p/8428372.html
Copyright © 2011-2022 走看看