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模式,即只显示有可能的改变,但实际并不执行。

  • 相关阅读:
    Mac基本操作记录
    flutter vscode+第三方安卓模拟器
    git一些基本操作
    获取点击元素的绝对位置
    windows下提交前检测操作
    VGG网络学习
    MySQL数据库中文乱码
    配深度学习环境中的小tips(tensorflow+anaconda+keras+cuda)
    Docker安装指定的anaconda
    yolov1阅读
  • 原文地址:https://www.cnblogs.com/zejin2008/p/8428372.html
Copyright © 2011-2022 走看看