include directory, exclude contents

tim rsync at nsr500.net
Tue Dec 2 19:41:43 EST 2003


I'm using a simple client/server backup pull model

rsync -a --delete -e ssh --exclude-from=$exclude path/$client.exclude \
   ${client}-rsync:/ $path/$client

but can't seem to find the right 'exclude' combination to fetch certain 
directories but not their contents.  Unfortunately this was found during a 
recent major restore where the excluded directories had to be manually 
recreated.

After more than 30 dry runs using variations in leading/trailing slash plus 
wild cards, such as:

+ .ccache/
- .ccache/**

or:

+ /cdrom/
- /cdrom/*

I get either no directory or (directory + contents), but not (directory - 
contents).  I have looked back from current till Oct. 02 but can not find 
an example of anyone wanting to do this.

Debug didn't make much sense as the exclude scan seems not to recognize an 
include (unless this is just syntax):

add_exclude(/.ccache/,exclude)
add_exclude(+ .ccache/**,exclude)

Thanks,
Tim.




More information about the rsync mailing list