Rsync

From MyWiki
Revision as of 08:43, 17 November 2014 by George2 (Talk | contribs)

Jump to: navigation, search

rsync -e 'ssh -p 30000' -avl --delete --stats --progress demo@123.45.67.890:/home/demo /backup/
--exclude-from '/home/backup/exclude.txt'
[root@tecmint]$ rsync -avz rpmpkgs/ root@192.168.0.101:/home/
[root@tecmint]# rsync -avzh root@192.168.0.100:/home/tarunika/rpmpkgs /tmp/myrpms
rsync -avzhe ssh root@192.168.0.100:/root/install.log /tmp/
rsync -avzhe ssh backup.tar root@192.168.0.100:/backups/

4. Exclude path is always relative
 
If you are not careful, you might make this mistake.
 
In the following example, the exclude option seems to have a full path (i.e /dir1/dir2/file3.txt). But, from rsync point of view, exclude path is always relative, and it will be treated as dir1/dir2/file3.txt. In the example below, rsync will look for dir1 under source directory (and not under / root directory).
 
$ rsync -avz --exclude '/dir1/dir2/file3.txt' source/ destination/
 
So, the above command is exactly same as the following. Just to avoid confusion (and to make it easy to read), don’t give / in front of the exclude path.
 
$ rsync -avz --exclude 'dir1/dir2/file3.txt' source/ destination/