On Mon, May 24, 2010 at 8:50 AM, Leon Castellanos
<lcastellanos at mentora.com>wrote:
> Does anyone know if ?delete can work with ?files-from?
>
That depends on what you'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.
For what you'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.
Here's how to use show and hide:
Start by creating anchored show (S) rules for filter (I just added "S
/"
here):
find $DIR/lvl1 -maxdepth 1 -type f ?mmin +30| /usr/bin/awk -F/ '{print
"S
/"$8"/"$9}' >/tmp/$FILES;
Those rules should look like "S /lvl1/foo" because (I believe) you
want lvl1
as part of the transfer.
Then, do a copy something like this:
rsync -ptrgoz --stats --delete --fiter=". /tmp/$FILES"
--filter="H /lvl1/*"
$DIR/lvl1 $RDEST/
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.
..wayne..
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.samba.org/pipermail/rsync/attachments/20100529/22a14347/attachment.html>