On Mon, 26 Nov 2007, Ivan Shmakov wrote:
Benjamin R Haskell <dovecot@benizi.com> writes:
[...]
And something to watch out for as a new rsync user:
The trailing slash is important on the source path. From the rsync 'man' page (read it!): A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination.
To put it short, SRC-DIR refers to a directory, and SRC-DIR/ -- to its contents.
That always seemed like an odd way to put it. Saying "its contents" implies (or at least leads me to suspect) that SRC-DIR/ would be synonymous with SRC-DIR/* But, it's not. The former updates the permissions/attributes on DEST-DIR, but the latter doesn't.
Illustration by example, (now that we're way off topic) :-)
$ mkdir foo
$ cd foo
$ umask 077
$ mkdir -p sa/sb
$ echo foo > sa/sb/sc
$ chmod 770 sa
$ mkdir with-slash without-slash with-star
$ rsync -av sa without-slash
$ rsync -av sa/ with-slash
$ rsync -av sa/* with-star
$ tree -p -L 2
.
|-- [drwxrwx---] sa
| -- [drwx------] sb |-- [drwxrwx---] with-slash |
-- [drwx------] sb
|-- [drwx------] with-star
| -- [drwx------] sb
-- [drwx------] without-slash
`-- [drwxrwx---] sa
The important bits: No 'sa' directory in with-slash or with-star. Permissions on with-slash are the same as 'sa', but with-star doesn't match.
Best, Ben