Thanks Matt, that was great information. I think I don't need to use exclude at all and just need to user H and P flags with --filter option. Also I will need to use --delete option to remove directories filtered H flag. The below command meets exactly my requirements:
rsync -avz /foo/bar/ --delete --filter='P /baz' --filter='H /abc' --filter='P /old-baz' desthost:/foo/bar/ Am I missing anything or anything could be done better way? I hope that --include option would not get affected with these options. Thanks a tons, Jignesh On Mon, Jul 27, 2009 at 3:15 AM, Matt McCutchen <m...@mattmccutchen.net>wrote: > On Sun, 2009-07-26 at 21:37 +0530, Jignesh Shah wrote: > > I have a situation where I want to delete some of my excluded patterns > > but still want to preserve some other. For example consider below > > source and destination directory hierarchy. > > > > Source Dest > > ---------- --------- > > /foo/bar/ /foo/bar/ > > | -> baz | -> baz > > | -> xyz | -> xyz > > | -> abc | -> abc > > | -> old-baz > > > > I am below comand using --delete-excluded and as a result rsync > > deletes exluded directories "baz" and "abc" and also deletes > > "old-baz". I want to preserve the "old-baz" and "baz" directories on > > destination side and want "abc" to gets deleted. Could you tell me how > > to tell rsync to do this? > > > > rsync -avz /foo/bar/ --delete-excluded --exclude=/baz --exclude=/abc > > desthost:/foo/bar/ > > Recall that an exclude filter is shorthand for a hide plus a protect if > --delete-excluded is off, or just a hide if it is on.. Since you want > some of your filters to protect destination files from deletion but not > others, your best bet would be to drop the --delete-excluded and specify > individual hide, protect, and plain exclude (hide+protect) filters. For > more detail, carefully read the "FILTER RULES" section of the man page. > > Something like the following should do what you described: > > rsync -avz /foo/bar/ --exclude=/baz --filter='H /abc' \ > --filter='P /old-baz' desthost:/foo/bar/ > > -- > Matt > >
-- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html