--delete-during acts like --delete-before

Michal Soltys soltys at ziu.info
Wed Sep 8 18:05:20 MDT 2010

On 10-09-09 01:07, Craig Bell wrote:
>    Hello, I use rsync v3.0.7 with "--delete-during", but it appears to act more like "--delete-before".  I've checked the docs and list archives, but I am still discovering some of the subtleties of rsync, and I can't see where I'm going wrong.  There's an example of my issue below... can anybody set me straight?  =-)

Functionally yes.

In more details, if you for example do rsync A -> B with 
--delete-before, rsync will do:

1) 1st delete pass, honoring global (on B or sent from A, if rsync was 
executed on A) and per directory (on B) rules of what to protect/delete 
(see --filter's options R & P)
2) 2nd transfer pass

If you used --delete-after - the order of the above would be reversed - 
first transfer (which would have potentially useful effect of first 
transferring [updated] per directory rules from A -> B, and then using 
them for deletion during 2nd pass (delete).

If you used --delete-during - rsync would combine 1st and 2nd pass of 
--delete-before into single pass, where deletion and transfer would be 
done on directory per directory basis, recursively.

--delete-delay combined with --delete during would alter that combined 
pass in the following way - on a dir-by-dir basis:

1) find what to delete
2) transfer files
3) delete

This is almost like --delete-after, but it won't work if you expect 
updated per directory rules to be used for delete pass.

>    It looks like "--delete-during" should operate in-fix, i.e. step into a directory, delete the old file, pull the new file, and then move on to the next directory.   For my transfers, all deletes seem to take place up front.  The destination directory is emptied at the beginning of the session, which is what I want to avoid in case the link is severed, and the transfer is interrupted.

--delete-delay is probably what you're after. Also check options:
--ignore-existing, --ignore-non-exisitng, --partial, --delay-updates

More information about the rsync mailing list