rsync 命令使用

首先rsync命令是单向同步,

rsync -avv left/ right/ 

right不会影响到left

排除文件(夹)

rsync -arv --exclude-from='/home/ben/exclude_me.txt' /home/ben /media/ben/thumbdrive/

exclude_me.txt

.ccache
build
.java
.gvfs
.xsession-errors
  • /dir/ means exclude the root folder /dir
  • /dir/* means get the root folder /dir but not the contents
  • dir/ means exclude any folder anywhere where the name contains dir/

远程到本地

rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine

本地到远程

rsync -a ~/dir1 username@remote_host:destination_directory
posted @ 2020-12-11 21:31  2021年的顺遂平安君  阅读(225)  评论(0编辑  收藏  举报