[linux]在使用rsync时需要注意的小细节

很简单:前一个目录末尾是目录的话,最后是否带/是有区别的。

具体看测试:

# usr @ the-pc in ~/cptest02 [2:28:02] 
$ ll 
总用量 0

# usr @ the-pc in ~/cptest02 [2:28:03] 
$ ll ../cptest01/ 
总用量 4
-rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp

# usr @ the-pc in ~/cptest02 [2:28:14] 
$ rsync -av ../cptest01/ ./
sending incremental file list
./
11111file
pppp/
pppp/adadasd.file

sent 187 bytes  received 57 bytes  488.00 bytes/sec
total size is 0  speedup is 0.00

# usr @ the-pc in ~/cptest02 [2:28:33] 
$ ll 
总用量 4
-rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp

# usr @ the-pc in ~/cptest02 [2:28:46] 
$ rsync -av ../cptest01 ./ 
sending incremental file list
cptest01/
cptest01/11111file
cptest01/pppp/
cptest01/pppp/adadasd.file

sent 201 bytes  received 58 bytes  518.00 bytes/sec
total size is 0  speedup is 0.00

# usr @ the-pc in ~/cptest02 [2:28:53] 
$ ll 
总用量 8
-rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
drwxrwxr-x 3 usr usr 4096 10月 11 02:23 cptest01
drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp

# usr @ the-pc in ~/cptest02 [2:28:56] 
$

(shell是zsh,主题是ys。)

posted @ 2019-09-12 20:34  HmLy  阅读(507)  评论(0编辑  收藏  举报