I'm working on a script to selectively synchronize certain users' directories with those on a server using rsync (version 3.0.5 protocol version 30). I am using the --exclude-from command option, and everything works, except when a directory I am specifying contains a hyphen. Then I can't get a patten match and the directory (and all its children) will not sync. I have tried to escape the hyphen with a backslash, and replace it with an ampersand or a dot or an asterisk to wild card it. The command I am using is:
rsync -avze ssh --dry-run --exclude-from='/home/user/excl.tmp' server01:/usr2/ /home/user/usr2/
Examples of excl.tmp file. This works:
This doesn't work (it only syncs the directory named gale):
Note that rsync will happily sync other files with a hyphen in the name, it just fails to pattern match them when they are specified in the exclude file.
Other details: The local machine is running ubuntu 9.04, while the remote server is running RedHat Enterprise Linux 5.4