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

2021-08-09  本文已影响0人  捌千里路雲和月
[root@localhost test]# mkdir backups_directory    ## backups_directory 目录用作储存源目录
[root@localhost test]# 
[root@localhost test]# mkdir backups_file    ## backups_file 目录储存源目录的文件
[root@localhost test]# 
[root@localhost test]# tree    ## 查看目录结构
.
├── backups_directory
├── backups_file
└── SRC
    ├── demo1.txt
    ├── demo2.txt
    └── demo3.txt

3 directories, 3 files

## SRC 目录后没有带 / 号,是整个 SRC目录递归传输到 backups_directory 目录下
[root@localhost test]# rsync -a SRC backups_directory/    

## SRC 目录后带 / 号,是 SRC目录下的文件传输到 backups_file 目录下
[root@localhost test]# rsync -a SRC/ backups_file/
[root@localhost test]# 
[root@localhost test]# tree    ## 目录结构如下
.
├── backups_directory
│   └── SRC
│       ├── demo1.txt
│       ├── demo2.txt
│       └── demo3.txt
├── backups_file
│   ├── demo1.txt
│   ├── demo2.txt
│   └── demo3.txt
└── SRC
    ├── demo1.txt
    ├── demo2.txt
    └── demo3.txt

4 directories, 9 files
[root@localhost test]# 

上一篇下一篇

猜你喜欢

热点阅读