Search code examples
centosrsync

rsync exclude not excluding directory


I am having issues excluding a single directory from copying from remote machine to my local.

This is the command I used:

rsync -chavzP --stats --exclude='/var/www/html/px3' root@IPHERE:/var/www/html /Users/mainuser/Documents/somefolder

folder /var/www/html/px3 is supposed to be left alone, but the command starts to index its contents. The folder is 100GB big, so I just cancel the command.

What am I missing?


Solution

  • In rsync exclude path is relative to the source path. So in your case you are trying to exclude: /var/www/html/var/www/html/px3

    You should change it for:

    rsync -chavzP --stats --exclude=/px3 root@IPHERE:/var/www/html /Users/mainuser/Documents/somefolder