You are not logged in.

#1 2008-06-26 10:49:17

RAH
Member
Registered: 2008-06-20
Posts: 205

[SOLVED] rsync

Hello,

I want to achieve the following with rsync but not quite sure how to go about doing so.

When booting up my linux laptop I want any new or updated files/folders in a particular folder on my linux server to be downloaded onto my laptop replacing any existing files with the latest versions and creating those which don't exist.  Additionally files which have been deleted on the server should also be deleted locally.

When shutting down my laptop I want any new/updated files on my laptop to be uploaded to my server in the same fashion as above including deleting files off the server which no longer exist on my laptop.

All of the above should be recursive and only updated/new files uploaded.

How can I achieve this?

Thanks.

Last edited by RAH (2008-06-26 16:28:55)

Offline

#2 2008-06-26 11:14:38

Stythys
Member
From: SF Bay Area
Registered: 2008-05-18
Posts: 878
Website

Re: [SOLVED] rsync

On startup, execute: 'rsync --delete -av <user>@<server>:<path> <local-folder>'

On shutdown, execute: 'rsync --delete -av <local-folder> <user>@<server>:<path>'

Last edited by Stythys (2008-06-26 11:16:33)


[home page] -- [code / configs]

"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol

Offline

#3 2008-06-26 12:52:55

axel
Member
Registered: 2007-12-10
Posts: 77

Re: [SOLVED] rsync

You could use grsync, a GUI for rsync to easilly see how rsync works. Take a look in this link also:

How to backup/synchronize your files using rsync

Offline

#4 2008-06-26 15:20:33

RAH
Member
Registered: 2008-06-20
Posts: 205

Re: [SOLVED] rsync

How can I exclude a certain local directory from being synced?

Offline

#5 2008-06-26 15:22:49

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: [SOLVED] rsync

I really, really suggest you read the rsync manpage.  These simple questions can be answered from there.

       --exclude=PATTERN
              This option is a simplified form of  the  --filter  option  that
              defaults  to  an  exclude rule and does not allow the full rule-
              parsing syntax of normal filter rules.

              See the FILTER RULES section for detailed  information  on  this
              option.

Example usage (from the same manpage):

rsync -avuzb --exclude='*~' samba:samba/ .

Offline

Board footer

Powered by FluxBB