Hello list, I try to keep a list of directories/files on windows in sync with the ones on a remote machine. Basically syncing works fine, however I am stuck/confused with the various possiblities using include/exclude options. Your help is very much appreciated. Here's the scenario: Local source dir: /cygdrive (seems to be required or else the cygwin-HOME is set) Remote destination dir: ~/data Local file tree to be synced, that may vary each time rsync is run: C:\test1\a1\ b1\ c1\ C:\test2\a2\ b2\ So I created a file "files.txt" containing: C/test1 C/test2 And then I call rsync: $ rsync -avvr --temp-dir=temp --delete -e ssh --stats --files-from=files.inc /cygdrive storage@192.168.2.111:data This copies all the directories just fine to the remote machine. However, when I run rsync wiht a different file tree to be synced, say: C:\test1\a1\ b1\ c1\ C:\test3\a3\ b3\ The directory "~data/C/test2" does not get deleted on the remote side. How can I achieve this? How do I have to set the options so that any directory/file on the remote side that is not explicitly listed as include path gets deleted? Thanks VERY much for any help on this! Dave.
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@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..