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. |
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 |
Look up the rsync tool, it's designed for this type of thing :)
|
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.
|
All times are GMT -5. The time now is 08:40 AM. |