rsync exclude

From WebHostingNeeds.com
Jump to: navigation, search

When you exclude, make sure you use relative path (not full path).

Method 1

rsync --exclude-from=/path/to/exclusion-file /path/to/source /path/to/dest

Now create a file /path/to/exclusion-file with files/folders to exclude.

Example

rsync command for server full backup.

rsync -avz "-e ssh -p 3344" --exclude-from=/usr/hostonnet/rsync_backup_ignore.txt / [email protected]:/disk1/server1.webhostingneeds.com/

Exclude file

[[email protected] ~]# cat /usr/hostonnet/rsync_backup_ignore.txt
/tmp
/srv
/lib
/bin
/lib64
/lost+found
/sbin
/media
/backup_drive
/backup
/mnt
/opt
/.cache
/proc
/selinux
/sys
/dev

[[email protected] ~]#


Method 2

rsync -a -v --progress --timeout=0 -e "ssh -p 3333" --exclude .git /home/yourblin/public_html/ [email protected]:/home/blinddis/public_html/

In following command

 --exclude .git /home/yourblin/public_html/

/home/yourblin/public_html/.git/

Folder will be excluded when rsync.



rsync