LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How do I syncronise 2 directories (https://www.linuxquestions.org/questions/slackware-14/how-do-i-syncronise-2-directories-573865/)

synapse 08-01-2007 01:58 AM

How do I syncronise 2 directories
 
Hi

Ok having a laptop and a desktop usually results in different info under the a users directories.

I woluld like to have the same info on either machine.

Ie if a user logs in on the laptop and creates files etc, somehow at the end of the day the same files will be copied over to the desktop machine at some time. And vice versa , if a user logs on to the desktop and creates files , evetnually the files will be replicated to the laptop.

How do I do this.

Obviously I can copy and paste the whole user directory but this will have problems. ie what if new files exist on both machines at the time of copy then the new files on the destination machine will get replaced.

Any Ideas

Thanx

jlliagre 08-01-2007 02:15 AM

Commonly used tools for that are rsync and unison.

synapse 08-01-2007 02:58 AM

Hi

thanx will look into the man pages for this.

will rsync sync both ways or wil i hav to run rsync from each machine at a different time ?

ppoisson 08-02-2007 01:13 AM

Why don't you use NFS?
It'll solve your home directory replication problems.

jlliagre 08-02-2007 02:27 AM

If you mean sharing a single repository between both machines, it would only marginally help.
A laptop, by design, is mobile so it can't be constantly connected to a network.

BCarey 08-02-2007 03:53 PM

Quote:

Originally Posted by synapse
Hi

thanx will look into the man pages for this.

will rsync sync both ways or wil i hav to run rsync from each machine at a different time ?

I think you need to rsync both ways, but you can run the script from one machine. I don't know about unison.

Brian Carey

Franklin 08-02-2007 04:13 PM

If you use KDE, you might want to look into the krusader file manager {http://www.kde-apps.org/content/show.php?content=10214}.
It has a nice sync utility that is fairly intuitive to set up.
You can find the build script at http://www.slackbuilds.org/repositor...stem/krusader/.

rg3 08-02-2007 05:58 PM

Disclaimer: I haven't used unison, so I don't know if it solves the following problem.

What the OP asked is quite hard to automate without using NFS (or something similar) as it has already been suggested. The problem are deleted files. If a file is in one drive but not in the other, is that because the file has been removed in one end or because it has been added in the other end? Granted, you could ommit the --delete option in rsync, but that way you would be unable to delete any files. So you probably want the --delete option. If you don't carefully sync always before using one computer or after having used it, you could (a) make an old file appear (which shouldn't be very important) or (b) make a new file disappear. The second case is problematic, so you need to run rsync manually and carefully to avoid those mistakes.

synapse 08-03-2007 09:03 AM

Hi

Just managed to get back here, Thanx for the valued info. Ill go with the rsync option but as rg3 says its going to get a little confusing, quite a problem though cause one minute you are using the laptop , the next you are using the desktop and vice versa. Maybe just create 1 directory that gets synced one way only. mmmm

Well thanx anyways

BCarey 08-03-2007 10:02 AM

If you really need 2-way, unison seems a better choice.

Brian


All times are GMT -5. The time now is 02:00 AM.