Help with complicated heirarchy exclude syntax

reader at reader at
Tue Dec 25 17:08:55 GMT 2007

reader at writes:

> Matt McCutchen <matt at> writes:
>> To get the rules to apply only in ~/News, anchor the patterns and use
>> the ** syntax to match anything below ~/News.  The patterns are matched
>> against files' full paths from ~, but the first pattern accepts a
>> non-numeric character only in the basename because the final * cannot
>> match slashes.
>> --include='/News/**[!0-9]*' --exclude='/News/**'
> Haa... what I took to be a horribly complicated matter... barely even
> conceivable by mortal men, turned out to be pretty simple in the hands
> of someone who knows what they are doing. :)

Tragically I'm still getting flummixed over what I thought I'd gotten
understood from earlier help.... But, going the other way round for a
different kind of backup:

   --include='/nntp/**[!a-zA-Z]*' --exclude='/nntp/**'

Seems to fail miserably in the face of a proven technique.

This command (run in dry run mode to study the output):

  rsync  -navv    --include='/nntp/**[!a-zA-Z]*' \
             ~/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
  total: matches=0  hash_hits=0  false_alarms=0 data=0

The directories are populated like:

with a few numbered files and a few alphabet named files thrown in


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

More information about the rsync mailing list