RSYNC
RSYNC
- Can transfer files inside local machine, between local & remote & remote to remote
- Uses OpenSSH to trasnfer files
- Preferred for source to destination kind of sync (one direction rather than birectional sync)
1
2
3
4
rsync srcFolder userName@serverIP:/destFolder
rsync srcFolder destFolder
rync -avP src dest
RSYNC Flags
a - archive mode allows metadata transfer to have exact match file on the destination
v - verbose will list the copying files
z - compress the file and then transfer
-P - shows progress
–dry-run - test run
–delete - syncs delete too
–remove-source-files - removes file from source
RSYNC Local Folder with a Server
1
2
3
4
//push local to remote
rsync -avz --exclude='.git' -e 'ssh -i /pathToSSHPrivateKey' /pathToLocalFolder serverUser@serverIP:/pathToRemoteFolder
//pull remote to local
rsync -avz --exclude='.git' -e 'ssh -i /pathToSSHPrivateKey' serverUser@serverIP:/pathToRemoteFolder/ /pathToLocalFolder/
This post is licensed under
CC BY 4.0
by the author.