option --delete still not completely working (2.5.2)

Dave Dykstra dwd at bell-labs.com
Tue Jan 29 06:11:13 EST 2002

On Mon, Jan 28, 2002 at 11:05:38AM -0600, Dave Dykstra wrote:
> I'm the one who put in that wording because I think I didn't completely
> understand what it did at the time.  I just changed the wording to
>           This option tells  rsync  to  delete  directories  when
>           non-directories  (for  example symlinks or plain files)
>           take their place even if the  deleted  directories  are
>           not  empty.   This  applies to both the --delete option
>           and to cases where rsync tries to copy  a  normal  file
>           but  the  destination  contains a directory of the same
>           name.
> and I deleted the second paragraph about "very obscure cases".

Hold on, this is still wrong.  The depth-first search does cause the
destination directories to be deleted, as in this test:

    mkdir s d d/d
    touch s/f d/d/f
    rsync -a --delete s/ d/

The d/d directory does get replaced with d/f.

Here's what I wrote about this nearly 3 years ago:

On Thu, Feb 18, 1999 at 07:11:36AM +1100, dwd at samba.anu.edu.au wrote:
> I just wrote:
> > Tridge and I discovered recently that --force currently has no effect
> > because deletes are always done depth first.
> I take it back.  As I was looking into changing the man page I discovered
> an obscure case where it does make a difference: when copying from a file
> when using -a (!) and the target is a non-empty directory.  Reproduce with
>     mkdir /tmp/bin /tmp/bin/wc
>     touch /tmp/bin/wc/f
>     rsync -av /bin/wc /tmp/bin
>     rsync -av --force /bin/wc /tmp/bin
> Change any of the variables I mentioned and --force makes no difference.
> If anybody can give me a non-confusing way of explaining *that* in a man
> page I'd appreciate it :-(    I think I'd rather turn it into a no-op and
> say that it is obsolete.

On Mon, Jan 28, 2002 at 10:02:42AM -0600, Phil Howard wrote:
> I'm still curious why --delete by itself didn't remove the members of
> the directory at the target, since those didn't exist at the source.
> It would have been helpful if the --delete documentation made a
> reference to --force.

Can you give a simple example to demonstrate that?  I need to rewrite the
man page entry again.

- Dave Dykstra

More information about the rsync mailing list