--exclude-from and a directory name that contains a hyphen

Wolter, John D. (GRC-RTE0) john.d.wolter at nasa.gov
Thu Apr 22 10:04:46 MDT 2010


I'm having a problem with an exclude list and I wanted to run it by the group before I cry "Bug!".  Here's the scenario:

I'm working on a script to selectively synchronize several 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 pattern 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:
+ /gale
+ /gale/tools
+ /gale/tools/**
- *

This doesn't work (it only syncs the directory file named gale):
+ /gale
+ /gale/solver-alpha
+ /gale/solver-alpha/**
- *

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.  Furthermore, I tried it out on another machine with rsync 2.6.8 and it works.  I went back to my original machine and upgraded rsync to 3.0.7 and still no luck.  I looked at Bugzilla and didn't see any items covering this, though I might have missed something, particularly if I'm just seeing the tip of an iceberg.  Can anyone reproduce this so I know it's not just something I'm doing wrong?

Other details:  The local machine is running ubuntu 9.04, while the remote server is running RedHat Enterprise Linux 5.4.  The other machine (on which rsync 2.6.8 is installed) is also running RHEL 5.4.

John D. Wolter
Aerospace Engineer
NASA Glenn Research Center



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20100422/4e26359c/attachment.html>


More information about the rsync mailing list