# 查看一下源目录里面的文件
[root@localhost ~]# ll /root/temp/
total 0
-rw-r--r--. 1 root root 0 Apr 7 21:46 name.csv
# 查看一下目标目录里面的文件
root@192.168.43.137's password:
total 944
drwxr-xr-x. 2 root root 6 Apr 7 2021 anaconda
drwx------. 2 root root 6 Apr 7 2021 audit
-rw-------. 1 root root 0 Apr 7 2021 btmp
-rw-------. 1 root root 0 Apr 7 2021 btmp-20210406
drwxr-xr-x. 2 root root 6 Apr 7 2021 chrony
-rw-------. 1 root root 8432 Apr 7 2021 cron
-rw-------. 1 root root 12200 Apr 7 2021 cron-20210221
-rw-------. 1 root root 48130 Apr 7 2021 cron-20210228
-rw-------. 1 root root 3910 Apr 7 2021 cron-20210308
-rw-------. 1 root root 22455 Apr 7 2021 cron-20210406
-rw-------. 1 root root 383369 Apr 7 2021 dnf.librepo.log
-rw-------. 1 root root 476949 Apr 7 2021 dnf.librepo.log-20210221
# rsync使用--delete选项删除目标目录中不包含源目录的文件
root@192.168.43.137's password:
sending incremental file list
deleting temp/chrony/
deleting temp/audit/
deleting temp/anaconda/
deleting temp/dnf.librepo.log-20210221
deleting temp/dnf.librepo.log
deleting temp/cron-20210406
deleting temp/cron-20210308
deleting temp/cron-20210228
deleting temp/cron-20210221
deleting temp/cron
deleting temp/btmp-20210406
deleting temp/btmp
temp/
temp/name.csv
sent 123 bytes received 281 bytes 161.60 bytes/sec
total size is 0 speedup is 0.00