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 contentsdir/
means exclude any folder anywhere where the name containsdir/
远程到本地
rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine
本地到远程
rsync -a ~/dir1 username@remote_host:destination_directory