Sorry, I think I wasn&#39;t much clear. Here is the exact issue:<br><br>destHost#&gt; ls  /tmp/mydir/2008<br>file      mydir3    new       preserve<br><br>The below command deletes the &quot;/tmp/mydir/2008/mydir3&quot; directory.<br>
<br><span style="color: rgb(255, 0, 0);">sourceHost#/tmp/mydir&gt;</span> rsync -avz --relative --delete --include=&#39;+ /2008/.&#39; --filter=&#39;H /2008/mydir3&#39; --exclude=&#39;- /2008/preserve&#39; 2008/. destHost:/tmp/mydir<br>
sending incremental file list<br>2008/<br>deleting 2008/mydir3/<br><br>sent 138 bytes  received 17 bytes  34.44 bytes/sec<br>total size is 0  speedup is 0.00<br><br>The below command doesn&#39;t delete the &quot;/tmp/mydir/2008/mydir3&quot; directory but deletes &quot;/tmp/mydir/2008/new/mydir3&quot;. Is there any way to tell rsync to delete &quot;/tmp/mydir/2008/mydir3&quot; directory from below command?<br>
<br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">sourceHost#/tmp/mydir/2008&gt; </span>rsync -avz --relative --delete --include=&#39;+ /new/.&#39; --filter=&#39;H /mydir3&#39; new/. destHost:/tmp/mydir/2008<br>
sending incremental file list<br><br>sent 73 bytes  received 13 bytes  9.05 bytes/sec<br>total size is 0  speedup is 0.00<br><br><span style="color: rgb(255, 0, 0);">sourceHost#/tmp/mydir/2008&gt;</span> rsync -avz --relative --delete --include=&#39;+ /new/.&#39; --filter=&#39;H /mydir3&#39; new/. destHost:/tmp/mydir/2008<br>
sending incremental file list<br>new/<br>deleting new/mydir3/<br><br>sent 76 bytes  received 16 bytes  16.73 bytes/sec<br>total size is 0  speedup is 0.00<br><br>Thanks, Paresh<br><br><div class="gmail_quote">On Tue, Aug 4, 2009 at 12:55 AM, paresh masani <span dir="ltr">&lt;<a href="mailto:masaniparesh@gmail.com" target="_blank">masaniparesh@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>Basically, I want to preserve some of directories on destination side conditionally and hence, I choose to use --filter option mentioned in rsync man pages. I noticed that --filter option works as expected when I don&#39;t have --relative option used but in below case it doesn&#39;t work.<br>


<br>rsync  -avz  --relative --delete  --filter=&#39;H /mydir2&#39; --exclude=&#39;- /preserve&#39;  mydir1/. destHost:/tmp/mydir<br><br>I want to sync &quot;/tmp/mydir/mydir1&quot;, delete &quot;mydir2&quot; and protect and hide &quot;preserve&quot; directory on destination host.<br>


<br>I noticed that rsync doesn&#39;t deletes the &quot;mydir2&quot; on destination host but if I remove --relative then it does. Could anyone tell me is there any dependencies between Hide and Protect flag with --relative option? How to make rsync to delete directories with H flag set and --relative option specified?<br>


<br>Thanks.<br><br>
</blockquote></div><br>