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

Michal Soltys soltys at ziu.info
Thu Sep 9 15:23:02 MDT 2010

On 10-09-09 20:17, Craig Bell wrote:
> Michal Soltys wrote:
> As stated, I would prefer this, however I do not have enough space to keep two editions of the files.
> I must delete as I go along, however I don't want to delete everything up front, and risk exposure.
> My workaround was to run rsync once for each subdir, which worked but is far from optimal.

Well, the "stages" - file list transfer / delete scan / actual 
file transfer are not absolutely strict in context of dir-by-dir boundary. 
Try for example something analogous to:

for i in `seq 1 1 10` ; do mkdir -p {src,dst}/$i ; for j in `seq 1 1 10` ; do mkdir -p {src,dst}/$i/$j ; for k in `seq 1 1 10` ;  do touch src/$i/$j/file-$k ; touch dst/$i/$j/filea-$k ; done ; done ; done

and do rsync -a --delete-during -i localhost::del dst/ | tee log

In the log file, you should see interleaved delete and transfer groups-of-sorts. 
You shouldn't be risking much, and even if transfer is interrupted, rsync 
invocation with a few other options I mentioned should quickly fix things.

On a related note, if you call rsync locally, you will see strict 
boundaries though, e.g. with:

and do rsync -a --delete-during -i src/ dst/ | tee log

More information about the rsync mailing list