Help with complicated heirarchy exclude syntax

Matt McCutchen matt at
Tue Dec 25 21:00:05 GMT 2007

On Tue, 2007-12-25 at 11:08 -0600, reader at wrote:
>    --include='/nntp/**[!a-zA-Z]*' --exclude='/nntp/**'

> (run in dry run mode to study the output):


>   rsync  -navv    --include='/nntp/**[!a-zA-Z]*' \
>         --exclude='/nntp/**' 
>              ~/projects/backup/rsync/nntp ./here/
> produces this output:
>    sending incremental file list
>   [sender] showing directory nntp/news1 because of pattern /nntp/**[!a-zA-Z]*
>   [sender] showing directory nntp/news2 because of pattern /nntp/**[!a-zA-Z]*
>   [sender] hiding directory nntp/news1/comp because of pattern /nntp/**
>   [sender] hiding directory nntp/news2/comp because of pattern /nntp/**
>   delta-transmission disabled for local transfer or --whole-file
>   nntp/
>   nntp/news1/
>   nntp/news2/
>   total: matches=0  hash_hits=0  false_alarms=0 data=0

> I've tried lots of combination of slashes and ** but it looks to me
> like those shown above should work.

By analogy to the other case, those filter rules should exclude files
whose names are entirely alphabetic, and they seem to be doing exactly
that.  What were you trying to do?  If you want to traverse even
alphabetic directories to catch any non-alphabetic files inside, prepend
--include='/nntp/**/' (the trailing slash restricts the rule to match
only directories) and pass --prune-empty-dirs .


More information about the rsync mailing list