LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-05-2006, 09:17 PM   #1
Harimwakairi
LQ Newbie
 
Registered: May 2003
Posts: 15

Rep: Reputation: 0
Cron job to sync two directories


I just purchased a laptop and installed Ubuntu 5.10 on it. I'm a writing student and looking forward to being able to write wherever I am. That said, I also have a desktop machine that I have been using up until now. I keep all my writing in a folder on my desktop.

I'd like, if I could, to have a cron job on the notebook that would synchronize the desktop folder on my windows machine with a folder on my notebook. Basically both directories would contain the same files, and the script would compare timestamps between the two machines' copies and determine if it should copy a file from one machine to the other when it found a difference.

I already have SMB filesharing going between the two, and the appropriate drive from the Windows machine has been mounted using smbfs into the /mnt directory of my laptop so I can access it.

My two questions are, is there already a tool to sync two directories like this? And if not, would you write this as a perl script or is there a newer language that would be more suited?

Sorry if this is a little off-the-wall, but it's been a long time since I did any coding on a non-MS platform.
 
Old 01-05-2006, 09:49 PM   #2
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 114

Rep: Reputation: 15
Check out unison.

I haven't used it yet, but I will be trying it out soon.

It was mentioned in the April 2005 issue of Linux Journal.

The article is available on-line, but LQ will not allow an URL in this post as, it is my first reply (I'm sure they have a good reason for this).

Good Luck

jer
 
Old 01-05-2006, 09:58 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Look up the rsync tool, it's designed for this type of thing
 
Old 01-05-2006, 11:25 PM   #4
Harimwakairi
LQ Newbie
 
Registered: May 2003
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for the tips. I've installed unison using Ubuntu's package manager and it seems to be working great. I looked at rsync, but it seemed to be more of a one-way solution whereas unison will compare timestamps and do merges and so forth in bidirectional fashion, whic is what I'm looking for.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job petenyce Linux - Newbie 5 10-11-2005 04:03 PM
cron job wbatzle Linux - Newbie 2 07-12-2005 04:19 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 10:47 AM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM


All times are GMT -5. The time now is 11:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration