<div class="gmail_quote">On Mon, May 24, 2010 at 8:50 AM, Leon Castellanos <span dir="ltr">&lt;<a href="mailto:lcastellanos@mentora.com">lcastellanos@mentora.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">









<div lang="EN-US" link="blue" vlink="purple">

<div>

<p class="MsoNormal">Does anyone know if –delete can work with –files-from?</p></div></div></blockquote><div> </div><div>That depends on what you&#39;re expecting to be deleted.  Rsync only deletes files from within directories that it sends, so any directories mentioned in the --files-from list will have files deleted from inside them.  Items that used to be in the files-from list but are not anymore are outside the transfer, and will not be affected.  Since you are sending only files, nothing will ever be deleted.</div>
<div><br></div><div>For what you&#39;re doing, you should use a filter list instead.  With that, you construct a source directory that includes and excludes various files, and the destination will treat that edited directory as the content that it should duplicate.  You should either use show/hide filter rules (so hidden items are not protected from deletion on the receiver) or use --delete-excluded.</div>
<div><br></div><div>Here&#39;s how to use show and hide:</div><div><br></div><div>Start by creating anchored show (S) rules for filter (I just added &quot;S /&quot; here):</div><div><br></div><div>find $DIR/lvl1 -maxdepth 1 -type f –mmin +30| /usr/bin/awk -F/ &#39;{print &quot;S /&quot;$8&quot;/&quot;$9}&#39; &gt;/tmp/$FILES;</div>
<div><br></div><div>Those rules should look like &quot;S /lvl1/foo&quot; because (I believe) you want lvl1 as part of the transfer.</div><div><br></div><div>Then, do a copy something like this:</div><div><br></div><div><div>
rsync -ptrgoz --stats --delete --fiter=&quot;. /tmp/$FILES&quot; --filter=&quot;H /lvl1/*&quot; $DIR/lvl1 $RDEST/</div></div><div><br></div></div><div>Note the hide (H) rule hides any filename in the lvl1 dir not mentioned in the show list.  The lvl1 dir is being sent, so RDEST gets lvl1/foo files put in it.  Any old files in lvl1 get removed.</div>
<div><br></div>..wayne..<br>