On Mon, Oct 27, 2003 at 11:58:30AM -0500, M.D. DeWar wrote:
> I would like to backup some website directorys on one machine to another
> machine.
> I have read the rsync man pages and some sites but am still confused about
> how the command line should be.
> I will only run it from the command line every so often.
> I have tried several ways but can't figure it out. I guess I am having
> issues with how the directories should be listed on the command line.
> One the server that is to be backed up the directory is
> /home/sites/www.domain.com/web - all files and other directories are below
> the /web  and in reading it seemed I should keep the trailing slash off.
> on the server that the files will be copied to the directory is
> /home/domain/website/
> If I understood right the trailing slash should be on this one.
> ./rsync -ae ssh
> [EMAIL PROTECTED]:/home/sites/www.domain.com/web
> /home/domain/website/
> am I even close to being right ?

Hmmm... Having a trailing slash or not on the *target* directory
doesn't make much difference at all.  Having a trailing slash or not
on the *source* does make a difference.  Without the slash, the last
directory in the source path will be created in the target directory
and all of the contents copied relative to that.  With the slash, only
the contents of the source dir get copied across and end up directly
under the target directory.

I believe the command as you have written it will create


on the target server, with all of the various content under that
.../web/ directory.

Also, under FreeBSD, you don't need '-e ssh' as that's the default.

I think what you may need is:

rsync -avx \
    [EMAIL PROTECTED]:/home/sites/www.domain.com/web/

A couple of good things to do are a) use the -n 'dry-run' flag to see
what would happen given a particular command line and b) create some
dummy files and directories under /tmp, and use rsync(1) to copy them
around just on the local system:

    rsync -avx --delete /tmp/foo/ /tmp/bar/

which will soon give you an understanding of how the trailing slash
thing works.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to