rsync fails to exclude... sometimes?

Matt McCutchen matt at mattmccutchen.net
Wed Mar 19 19:22:45 GMT 2008


On Wed, 2008-03-19 at 10:11 -0700, rdwyer wrote:
> Rsync seems to intermittently ignore the exclude statement and copies them
> from time to time.

> rsync -avz --delete --update --stats
> --exclude=/library/webserver/documents/domains/mydomain/file_to_exclude.html
> -e ssh my_user at nnn.nnn.nn.nnn:/Web_Files/Domains/source_of_files/
> /library/webserver/documents/domains/destination_dir_of_files/

Probably you've just written the exclude rule incorrectly.  Rsync
matches an exclude pattern with a leading slash against source files'
file-list paths, which are relative to the source directory.  Thus, your
exclude rule is excluding a file:

my_user at nnn.nnn.nn.nnn:/Web_Files/Domains/source_of_files/library/webserver/documents/domains/mydomain/file_to_exclude.html

(if it exists), which would otherwise be copied to:

/library/webserver/documents/domains/destination_dir_of_files/library/webserver/documents/domains/mydomain/file_to_exclude.html

Maybe you meant something more like --exclude=/file_to_exclude.html ,
which would stop:

my_user at nnn.nnn.nn.nnn:/Web_Files/Domains/source_of_files/file_to_exclude.html

from being copied to:

/library/webserver/documents/domains/destination_dir_of_files/file_to_exclude.html

Matt



More information about the rsync mailing list