Hello List. I am using rsync to pull html files from a shared drive to 2 web server boxes to keep the files synchronized. However, I have a few files I do not want rsync to copy over because they contain information specific (IP address) to the box hosting them. Rsync seems to intermittently ignore the exclude statement and copies them from time to time. Is there a way to absolutely prevent rsync from copying a specific file in a directory where every file but that one is to be copied? My rsync statement complete with exclude looks like this: rsync -avz --delete --update --stats --exclude=/library/webserver/documents/domains/mydomain/file_to_exclude.html -e ssh my_user@nnn.nnn.nn.nnn:/Web_Files/Domains/source_of_files/ /library/webserver/documents/domains/destination_dir_of_files/ -- View this message in context: http://www.nabble.com/rsync-fails-to-exclude...-sometimes--tp16146668p16146668.html Sent from the Samba - rsync mailing list archive at Nabble.com.
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@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@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@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
On Wed, Mar 19, 2008 at 10:11:52AM -0700, rdwyer wrote:> Is there a way to absolutely prevent rsync from copying > a specific file in a directory where every file but that one is to be > copied?One thing you can do to prevent a particular file from being transferred is to give rsync an absolute-path hide filter: --filter='hide,/ /some/absolute/path/file_to_exclude.html' The hide rule is made absolute by the '/' modifier, and that will prevent that particular file from ever being sent. If you also want to prevent that file from being deleted on the receiving side, change the "hide,/" prefix to "exclude,/" (aka "-/"). ..wayne..