Stuck with include/exclude options

Wayne Davison wayned at samba.org
Mon Jan 10 19:40:15 GMT 2005


On Fri, Jan 07, 2005 at 05:25:14PM +0100, David E. Meier wrote:
> The directory "~data/C/test2" does not get deleted on the remote side.

Which is a very good thing, because you didn't tell it to transfer
test2, and rsync does not go around deleting things outside the
transferred file tree.

Rsync only deletes inside directories that it sends, so you'll need to
send the whole .../C/ dir if you want rsync to delete subdirs inside it.
If you only want to transfer some of the dirs inside .../C/, you'll need
to use the --include/--exclude syntax to limit which directories on the
source side get transferred.  Like this:

$ rsync -avvr --temp-dir=temp --delete -e ssh --stats
  --include=/test1/ --include=/test3/ --exclude=/*
  /cygdrive/C/ storage at 192.168.2.111:data

You can put the include/exclude statements into a file, like this:

+ /test1/
+ /test2/
- /*

And then use --include-from=FILE instead of the separate
--include/--exclude options.

..wayne..


More information about the rsync mailing list