The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Operating Systems
> Linux Help
|
Rsync / sync two folders? How do I do this 2-way?
Discuss Rsync / sync two folders? How do I do this 2-way? in the Linux Help forum on Dev Shed. Rsync / sync two folders? How do I do this 2-way? Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 1st, 2006, 06:30 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: Dallas, TX
Posts: 135
Time spent in forums: 10 h 27 m 28 sec
Reputation Power: 11
|
|
Rsync / sync two folders? How do I do this 2-way?
I'm trying to sync two folders on my system. I know I can use rsync to mirror two folders, but this appears to be only a one-way deal where dir1 is mirrored over dir2. What I need is to sync both dir1 and dir2 so that the latest copies of varies files (along with deletes) will be updated in whichever folder.
Is there a way to do this with rsync or with some other command?
Many thanks,
Steve
__________________
Steve Stringer
MapTechnica.com - Free mapping tools, zip code finder, and data for your custom mapping application.
StringerSites.com - Custom website development for small businesses
|

December 7th, 2006, 01:28 PM
|
|
|
|
Suppose your sync dirA with dirB. Then everything in dirB that is NOT also in dirA will be deleted if you start to sync dirA->dirB. The reverse is true, if you start the sync going dirB->dirA.
You have to have a "master" for a scheme like the one you want to work. You will have to set up a list of files for which dirA always will have the correct version, and another list for dirB. You can create two exclude files - one to prevent dirA->dirB from updating the files in dirB for which it is the master, and another list for
preventing the update of file that live in dirA for which those files are the master copy.
I don't know how you handle the problem of files with new names, say a new file pops up in dirB....
Basically the whole concept as presented has problems. What exactly are you trying to do? Not how you want to do it.
Last edited by jim mcnamara : December 7th, 2006 at 01:31 PM.
|

December 7th, 2006, 03:12 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: Dallas, TX
Posts: 135
Time spent in forums: 10 h 27 m 28 sec
Reputation Power: 11
|
|
Quote: | Originally Posted by jim mcnamara What exactly are you trying to do? |
In a word, sync. I have files on a desktop and a laptop (both Macs) that I need to keep synchronized. Sometimes I work on one set, other times I work on the other. Seems like this is a solved problem with countless utilities out there. However, rsync is built in and it seems odd that rsync doesn't handle this most basic of synchronization tasks.
In the end, I have done two things:
1) I've put both sets of source files under version control with SVN.
2) For less important things, I plunked down $$$ for a utility called ChronoSync.
So problem solved, though not in the way I had hoped, nor in a free manner. Seems only logical that rsync should handle this with ease. Guess not.
|

December 8th, 2006, 05:26 AM
|
 |
kill 9, $$;
|
|
Join Date: Sep 2001
Location: Shanghai, An tSín
|
|
Man, how did I miss this thread before?
Unison is a free tool I use for this (on Linux, but it works on Macs too). I guess it's not much use to tell you that *now* - sorry about that.
|

November 11th, 2012, 06:51 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Location: Belgrade, Serbia
Posts: 1
Time spent in forums: 47 m 46 sec
Reputation Power: 0
|
|
Hey,
I've stumbled upon your post today (I see it dates some 6 years ago  ) since I've faced the same problem  I figured out how to do the thing you wanted with rsync. You just pass the "-u" option (without quotes) to your parameter list when you execute the command.
I hope you found the answer already but others like me will surely find this reply useful.
Best regards.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|