The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Server Synchronization kumarrana UNIX for Dummies Questions & Answers 3 05-09-2008 12:28 AM
Date Synchronization tovohery AIX 5 04-19-2007 08:39 AM
Synchronization of 2 directories Hitori UNIX for Advanced & Expert Users 5 02-23-2007 07:37 AM
Time synchronization skotapal UNIX for Dummies Questions & Answers 1 10-29-2003 01:44 PM
Date synchronization skotapal UNIX for Dummies Questions & Answers 2 11-25-2002 10:36 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 2
directory synchronization

Can anybody help me on how to do directory synchronization. i have been reading about rsync and filesync but apparently it seems to me that synchronization is from a source directory to a destination directory only. how about if vice versa - wherein i need to synchronize both directories, updating based on the most recent data, whichever directory has it. is this possible with rsync or filesync? can you provide an alternative for this.
thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 05-15-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
IF you need two directories to match, in terms of actual file content as well as filenames,
then copy all the diifferent files from dir2 to dir1. Remove dir2 completely. Create dir2 as a link to dir1. Then you do not have to worry about synchronization. This assumes the directories are mounted on the same unix box. Otherwise, NFS mount dir1 on the remote box as dir2. In this case dir2 should not be at root level, ie. literally not : /dir2
Reply With Quote
  #3  
Old 05-18-2008
Registered User
 

Join Date: May 2008
Posts: 2
Jim,

Thanks for the reply. I agree that placing dir2 to dir1 and linking dir2 to dir1 synchronizes them, but how will i be able to determine that the files in dir2 are the most recent files and not those in dir1? How can I determine which files in which directory is more recent without manually checking them 1 by 1. And what if their directory structures are different?
Reply With Quote
  #4  
Old 05-18-2008
pupp's Avatar
cap_10hdx 1
 

Join Date: Feb 2008
Location: Jersey Shore
Posts: 340
ls -t will give you the last mod time of any file. just write a script that will compare each file in dir1 and dir2 and sync on the latest mod of the files. i don't understand why the file structure would be different if you are trying to sync the same stuff across two fs or platforms... do you mean the full paths are different? shouldn't matter.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0