You are not logged in.

#1 2011-04-24 13:02:00

johnnyponny
Member
Registered: 2011-04-23
Posts: 33

[SOLVED]Sync/mirror folders in realtime

I want to sync two folders, ~/Work with ~/Dropbox/Work, meaning when I change something in the ~/Work I want ~/Dropbox/ to change and vice versa. I know there is rsync but it only backups files as I understand it.

Last edited by johnnyponny (2011-04-24 13:21:46)

Offline

#2 2011-04-24 13:10:49

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [SOLVED]Sync/mirror folders in realtime

Why not just create a symlink of ~/Dropbox/Work in ~?

If you want some safety you can always use cron to do regular backups.

Last edited by demian (2011-04-24 13:12:17)


no place like /home
github

Offline

#3 2011-04-24 13:15:15

johnnyponny
Member
Registered: 2011-04-23
Posts: 33

Re: [SOLVED]Sync/mirror folders in realtime

I want the folders to be synced instantaneous if I can.

EDIT: Does this make two folders or just one?

Last edited by johnnyponny (2011-04-24 13:20:28)

Offline

#4 2011-04-24 13:23:38

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED]Sync/mirror folders in realtime

johnnyponny wrote:

I want to sync two folders, ~/Work with ~/Dropbox/Work, meaning when I change something in the ~/Work I want ~/Dropbox/ to change and vice versa. I know there is rsync but it only backups files as I understand it.

$ crontab -e

Have a cron job run this every minute:

*/1 * * * *                     rsync -avx --progress --delete-after ~/Work/ ~/Dropbox/Work/

Just know that the --delete-after switch will delete ANYTHING that isn't in ~/Work from ~/Dropbox/Work

...are you sure this is the behavior you want?  Also, that won't satisfy the "vice versa" part of your needs.

Last edited by graysky (2011-04-24 13:29:44)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2011-04-24 13:26:36

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [SOLVED]Sync/mirror folders in realtime

If you symlink, you'd have one folder. Why have two if you want them to have exactly the same content anyway?
If you want one as backup it'd make sense but then you'd  better put one of the folders on another data medium.


no place like /home
github

Offline

#6 2011-04-24 13:33:33

johnnyponny
Member
Registered: 2011-04-23
Posts: 33

Re: [SOLVED]Sync/mirror folders in realtime

Yeah I want one as backup on my computer, the other one is on the cloud I think.
here is what I did

ln -s ~/Work ~/Dropbox 
ln -s ~/Dropbox ~/Work

Last edited by johnnyponny (2011-04-24 13:33:59)

Offline

#7 2011-04-24 14:46:33

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [SOLVED]Sync/mirror folders in realtime

That's a loop you've created there, i.e. it won't work.
Here's what you do:
You remove ~/Work
You create a symbolic link of ~/Dropbox/Work in $HOME (~)
Now, you can access your Work directory in both ~/Work and ~/Dropbox/Work but all changes will take place in ~/Dropbox/Work which is best because dropboxd can instantly upload those changes. Also, you don't have to keep two directories in sync.
Since you still want a backup of your work, you take grayskys suggestion and create a cron tab

*/1 * * * *                     rsync -avx --progress --delete-after ~/Dropbox/Work/ /wherever/you/want/your/backup/

no place like /home
github

Offline

#8 2011-04-24 19:19:19

johnnyponny
Member
Registered: 2011-04-23
Posts: 33

Re: [SOLVED]Sync/mirror folders in realtime

Ok, thanks a lot!

Offline

Board footer

Powered by FluxBB