what --forcd does (was Re: option --delete still not completely working (2.5.2))
dwd at bell-labs.com
Thu Jan 31 01:15:26 EST 2002
On Mon, Jan 28, 2002 at 01:11:13PM -0600, Dave Dykstra wrote:
> 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.
> On Thu, Feb 18, 1999 at 07:11:36AM +1100, dwd at samba.anu.edu.au wrote:
> > 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.
I found another less obscure case where --force makes a diference: when
a non-directory replaces a directory when doing a normal recursive copy
mkdir /tmp/s /tmp/d /tmp/d/f
touch /tmp/s/f /tmp/d/f/f
rsync -av /tmp/s/ /tmp/d/ # fails
rsync -av --force /tmp/s/ /tmp/d/ # deletes /tmp/d/f recursively
I have changed the man page entry to this:
This options tells rsync to delete directories even
if they are not empty when they are to be replaced
by non-directories. This is only relevant without
--delete because deletions are now done depth-
first. Requires the --recursive option (which is
implied by -a) to have any effect.
- Dave Dykstra
More information about the rsync