include directory, exclude contents

tim rsync at nsr500.net
Wed Dec 3 07:57:00 EST 2003


Forgot to mention this:

server:  rsync version 2.5.4  protocol version 26
clients: rsync version 2.4.6  protocol version 24

Also I found this at http://rsync.samba.org/fom-serve/cache/93.html:

   How do I use rsync to replicate a directory structure without
   copying any files?

   rsync -av --include '*/' --exclude '*' source-dir dest-dir

How would you apply this include/exclude pair for a specific directory? 
FOr example,  every time a directory named 'tmp' shows up no matter where 
it is in the tree?

Thanks,
Tim.

tim wrote:
> 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