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

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

具体看测试:

 1 # usr @ the-pc in ~/cptest02 [2:28:02] 
 2 $ ll 
 3 总用量 0
 4 
 5 # usr @ the-pc in ~/cptest02 [2:28:03] 
 6 $ ll ../cptest01/ 
 7 总用量 4
 8 -rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
 9 drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp
10 
11 # usr @ the-pc in ~/cptest02 [2:28:14] 
12 $ rsync -av ../cptest01/ ./
13 sending incremental file list
14 ./
15 11111file
16 pppp/
17 pppp/adadasd.file
18 
19 sent 187 bytes  received 57 bytes  488.00 bytes/sec
20 total size is 0  speedup is 0.00
21 
22 # usr @ the-pc in ~/cptest02 [2:28:33] 
23 $ ll 
24 总用量 4
25 -rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
26 drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp
27 
28 # usr @ the-pc in ~/cptest02 [2:28:46] 
29 $ rsync -av ../cptest01 ./ 
30 sending incremental file list
31 cptest01/
32 cptest01/11111file
33 cptest01/pppp/
34 cptest01/pppp/adadasd.file
35 
36 sent 201 bytes  received 58 bytes  518.00 bytes/sec
37 total size is 0  speedup is 0.00
38 
39 # usr @ the-pc in ~/cptest02 [2:28:53] 
40 $ ll 
41 总用量 8
42 -rw-rw-r-- 1 usr usr    0 10月 11 02:23 11111file
43 drwxrwxr-x 3 usr usr 4096 10月 11 02:23 cptest01
44 drwxrwxr-x 2 usr usr 4096 10月 11 02:23 pppp
45 
46 # usr @ the-pc in ~/cptest02 [2:28:56] 
47 $ 

(shell是zsh。)

猜你喜欢

转载自www.cnblogs.com/senwren/p/rsync_attention_0.html