Re: du

[prev] [thread] [next] [lurker] [Date index for 2005/10/04]

From: Peter da Silva
Subject: Re: du
Date: 15:25 on 04 Oct 2005
> Let's say you have /a, /a/b, /a/c, and /x.  This:
>
>   rsync /a /x
>
> will create directories /x/a, /x/a/b, and /x/a/c.  On the other hand,
> this:
>
>   rsync /a/ /x
>
> will create directories /x/b and /x/c.

Well, yeh, of course it will. Any code that does tree walks is going to 
behave the same way.

rsync /a /x

"in "/x", create "a" containing "/a" and everything under it"

Creates /x/a, /x/a/b, and /x/a/c.

rsync /a/. /x

"in "/x", create "." containing "/a/." and everything under it"

Creates /x/./b and /x/./c, which is /x/b and /x/c.

rsync /a/ /x

"in "/x", create "" containing "/a/" and everything under it"

Creates /x//b and /x//c, which is /x/b and /x/c. This works because 
UNIX ignores superfluous path separators, so "//" becomes "/" and the 
trailing "/" vanishes.

> Presumably, this is to get around the problem where you want to copy 
> all
> of the contents of a remote directory, but you can't use globbing, 
> because
> that's expanded locally, by the shell.

It's not to "get around" anything. It's just doing *exactly* what you 
told it to do.

rsync is worthy of hate, but not for this.

There's stuff above here

Generated at 16:00 on 04 Oct 2005 by mariachi 0.52