rsync and trailing '/'

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Mar 5 12:48:18 UTC 2007


Noah wrote:
> rsync  version 2.6.9  protocol version 29
> 
> I am running rsync, and I wonder if having the trailing '/' at the end
> of the directory is proper configuration?
> 
> --- snip ---
> 
> /usr/local/bin/rsync -avz -e ssh globs at globs.com:/var/cron/ /var/cron/
> 

Presence of absence of the final '/' on the rsync *source* directory
means different things.

If you say:

   rsync -a foo/ bar/

directory bar will end up with a copy of the contents of foo. So a 
file foo/wibble.txt will end up as bar/wibble.txt. If
on the other hand you say:

   rsync -a foo bar/

then you end up with a directory structure 'bar/foo/...', and wibble.txt
ends up as bar/foo/wibble.txt

Other than that, the presence or absence of the trailing slash on the
*target* directory doesn't make a great deal of difference.  I usually
try and work things so that the rsync command line always has trailing
slashes on both the source and the destination directories simply for
consistencies' sake.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       Flat 3
                                                      7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW, UK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070305/5326831d/signature.pgp


More information about the freebsd-questions mailing list