2

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 root@xxxxx.com:/home/xxxxx/public_html /var/www/xxxxx/public_html

I have also tried:

rsync -azP root@xxxxx.com:/home/xxxxx/public_html --exclude=/home/xxxx/public_html/batchupload /var/www/xxxxx/public_html

What am I doing wrong here?

3

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:

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

Try just:

rsync -azP --exclude=public_html/batchupload root@xxxxx.com:/home/xxxxx/public_html /var/www/xxxxx/public_html
| improve this answer | |
  • 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 . – Yamaha32088 Dec 19 '14 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.