jcadima
8/29/2015 - 4:58 PM

rsync options


https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

Syntax:
rsync options source destination


Copy/Sync Files and Directory Locally (Will create directory if it doesnt exist)
rsync -zvh backup.tar /tmp/backups/


Copy a Directory from Local Server to a Remote Server
rsync -avz rpmpkgs/ root@192.168.0.101:/home/


Copy/Sync a Remote Directory to a Local Machine
rsync -avzh root@192.168.0.100:/home/tarunika/rpmpkgs /tmp/myrpms


Copy a File from a Remote Server to a Local Server with SSH
rsync -avzhe ssh --progress root@192.168.0.100:/root/install.log   /tmp/


Copy a File from a Local Server to a Remote Server with SSH
rsync -avzhe ssh --progress backup.tar root@192.168.0.100:/backups/


Using -include and -exclude Options

rsync command will include those files and directory only which starts with ‘R’ and exclude all other files and directory.

rsync -avze ssh --include 'R*' --exclude '*' root@192.168.0.101:/var/lib/rpm/ /root/rpm


Set the Max Size of Files to be Transferred
rsync -avzhe ssh --max-size='200k' /var/lib/rpm/ root@192.168.0.100:/root/tmprpm