How to sync or copy files between servers and/or workstations using RSYNC under CentOS Linux
Here’s a few quick tips on how to sync files between servers or workstations using rsync.
Frequently Used Arguments
- --delete : delete files that don’t exist on sender (system)
- -v : Verbose (try -vv for more detailed information)
- -e "ssh options" : specify the ssh as remote shell
- -a : archive mode
- -r : recurse into directories
- -z : compress file data
Sync local files to NEW server
1 |
rsync -r -a -v -e "ssh -l root" --delete /old/directory new.host.com:/new/directory |
Sync remote files from OLD server
1 |
rsync -r -a -v -e "ssh -l root" --delete old.host.com:/old/directory /new/directory |