4-10.11 Linux 中的文件同步传输 --- rsync

2021-09-07  本文已影响0人  捌千里路雲和月
[root@localhost test]# mkdir backups_suffix    ## 创建备份目录 backups_suffix
[root@localhost test]# 
[root@localhost test]# tree
.
├── backups_suffix    ## 备份目录
├── include-file.txt
└── SRC
    ├── directory
    │   ├── directory4
    │   │   └── demo4.txt
    │   ├── directory5
    │   │   └── demo5.txt
    │   └── file2.txt
    ├── directory1
    │   └── demo1.txt
    ├── directory2
    │   └── demo2.txt
    ├── directory3
    │   └── demo3.txt
    ├── file1.txt
    ├── file3.txt
    ├── file4.txt
    └── office_directory
        ├── docxfile.docx
        ├── elsxfile.elsx
        └── pptxfile.pptx

9 directories, 13 files
[root@localhost test]# rsync -bv SRC/file1.txt backups_suffix/
file1.txt

sent 83 bytes  received 35 bytes  236.00 bytes/sec
total size is 0  speedup is 0.00
[root@localhost test]# 
[root@localhost test]# ll backups_suffix/
total 0
-rw-r--r--. 1 root root 0 Sep  2 14:46 file1.txt      ## 14:46 第一个备份文件
[root@localhost test]# 
[root@localhost test]# 
[root@localhost test]# rsync -bv SRC/file1.txt backups_suffix/
file1.txt

sent 83 bytes  received 35 bytes  236.00 bytes/sec
total size is 0  speedup is 0.00
[root@localhost test]# 
[root@localhost test]# ll backups_suffix/
total 0
-rw-r--r--. 1 root root 0 Sep  2 14:47 file1.txt      ## 14:47 新的备份文件
-rw-r--r--. 1 root root 0 Sep  2 14:46 file1.txt~    ## 14:46 备份文件用 ~ 标识
[root@localhost test]# 
[root@localhost test]# 
[root@localhost test]# rsync -bv --suffix=.bak SRC/file1.txt backups_suffix/
file1.txt

sent 83 bytes  received 35 bytes  236.00 bytes/sec
total size is 0  speedup is 0.00
[root@localhost test]# 
[root@localhost test]# ll backups_suffix/
total 0
-rw-r--r--. 1 root root 0 Sep  2 14:48 file1.txt    ## 14:48 新的备份文件
-rw-r--r--. 1 root root 0 Sep  2 14:46 file1.txt~    ## 14:46 备份文件用 ~ 标识
-rw-r--r--. 1 root root 0 Sep  2 14:47 file1.txt.bak  ## 14:47 备份文件用 .bak 标识
[root@localhost test]# 
[root@localhost test]# 
[root@localhost test]# rsync -bv --suffix=.bak1 SRC/file1.txt backups_suffix/
file1.txt

sent 83 bytes  received 35 bytes  236.00 bytes/sec
total size is 0  speedup is 0.00
[root@localhost test]# 
[root@localhost test]# ll backups_suffix/
total 0
-rw-r--r--. 1 root root 0 Sep  2 14:49 file1.txt    ## 14:49 新的备份文件
-rw-r--r--. 1 root root 0 Sep  2 14:46 file1.txt~    ## 14:46 备份文件用 ~ 标识
-rw-r--r--. 1 root root 0 Sep  2 14:47 file1.txt.bak    ## 14:47 备份文件用 .bak 标识
-rw-r--r--. 1 root root 0 Sep  2 14:48 file1.txt.bak1    ## 14:48 备份文件用 .bak1 标识
[root@localhost test]# 

上一篇 下一篇

猜你喜欢

热点阅读