Skip to content

rsync

Be aware!

Rsync needs to be installed on both machines!

simple copy

  • Will create dir /tmp/file if it doesn't exist
Bash
rsync -zvh file.tar.gz /tmp/file/

copy with compression

Bash
rsync -avzh /some/file /tmp/file/

copy over ssh

Bash
rsync -e ssh -avzH --progress --info=progress2 --no-inc-recursive /webapps/jenkins/ <user>@<server-or-IP>/backup/jenkins.domain.xyz/jenkins-$(date +"%y%m%d")

copy over ssh and delete source

Bash
rsync -e ssh -avzH --progress --info=progress2 --remove-source-files --no-inc-recursive /webapps/jenkins.zip <user>@<server-or-IP>/backup/jenkins.domain.xyz/jenkins-$(date +"%y%m%d")

copy from remote to source

Bash
rsync -e ssh -avzH --progress --info=progress2 --remove-source-files --no-inc-recursive <user>@<server-or-IP>/backup/jenkins.domain.xyz/jenkins-$(date +"%y%m%d") /webapps/jenkins

exclude | include

Bash
rsync -avze ssh --include '*,jpg)' --exclude '*.png' [email protected]:/home/user/images data/images

If cannot find remote path of rsync

Bash
rsync -avz ~/Research/Folder1/folder2 -e "ssh -p 3345" --rsync-path=/path/to/remote/rsync [email protected]:/home/reusr/folder1/folder2