delete-before-update patch

Dave Dykstra dwd at
Thu Nov 22 08:40:07 EST 2001

On Wed, Nov 21, 2001 at 11:09:48AM -0800, Don Mahurin wrote:
> I have been using this simple patch enough that I know it works for my
> purpose,
> now I submit it here, for comments.
> --delete-before-update
>     implies -W, unlinks the destination file just before the new (temporary)
> file is written.
> This would be used when writing to a small or near full medium to use the
> minmum space when writing.

Looks fine, although since there are likely to be very few people who
would want that functionality I doubt if it will get into the official
rsync distribution.

> In my case, I happen to be writing to compact flash, so  since -W turns the
> block checksum off,  I need -c to force a checksum to ensure that byte wise
> identical files are not rewritten.
> Tim's comment below concerned me, but looking at the code, -W and -c can
> sensibly be used together.
> (correct me if I am wrong)
> -W turns off the per block checksum.
> -c turns on whole file checksum.
> so, the flags that I am using "--delete-before-update -c" make sense.
> tim.conway at wrote:
> > -W and -c are actually kind of opposite effects... -W means never
> > checksum... if it's different in length or time, send it.
> > -c means ALWAYS checksum, even if time and length are identical.

There's no reason why you can't use -W and -c together.  -W means don't
do the rolling checksum algorithm after you've identified a file to
transfer, and -c means do a full checksum in order to decide whether or
not to do any transfer.  Without -c, usually just the modification time
and file size is used to determine whether or not to do a transfer.

- Dave Dykstra

More information about the rsync mailing list