I am trying to pull from a remote server and exclude a directory on the remote server. For some reason it keeps pulling that directory I have excluded.

Here is the command I am running:

rsync -azP --exclude=/home/xxxx/public_html/batchupload [email protected]:/home/xxxxx/public_html /var/www/xxxxx/public_html

I have also tried:

rsync -azP [email protected]:/home/xxxxx/public_html --exclude=/home/xxxx/public_html/batchupload /var/www/xxxxx/public_html

What am I doing wrong here?

1 Answer 1


I believe the issue is that rsync sees the path names as being relative to the source directory. So, for example, if I'm syncing this directory:

$ ls /home/me/foo
bar  baz

Then the file paths it knows will be like foo/bar/... and foo/baz/.... If you add the verbose flag to rsync, you'll see things like:

         277 100%    0.56kB/s    0:00:00 (xfer#1390, to-check=0/1393)

Try just:

rsync -azP --exclude=public_html/batchupload [email protected]:/home/xxxxx/public_html /var/www/xxxxx/public_html
  • You were right about the relative path. In the example you gave it does not work with --exclude=public_html/batchupload. However --exclude=batchupload does work . Dec 19, 2014 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .