Need to syncronize to folders on laptop and usb memory stick
Hello! A have an issue and i hope there is a simple decision.
I need to synchronize a folder on my laptop with a folder on an usb flash drive. I think the same solution should be appropriate also to synchronize my phone pics with the desktop. I need something simple that works without internet connection, i.e. when i insert the usb stick, the program must synchronize the files bidirectionally. Also in that case it is important to me to have control about the direction. Sometimes i write something on my laptop and go to print the file (transmitting the file through the usb stick), but in other case i have to edit some document, or gen it, from the office computer and then move the copy on my laptop. The way to manually copy and paste is sometimes boring and leads to mistakes. Any suggestion should be appreciated! |
Have you tried unison : "Unison is a file-synchronization tool for Unix and Windows". It's in Slackbuilds
|
Assuming you have mounted the flash drive in /media/memory/
Code:
$ rsync -rLptDvu --delete /HDD/directory/ /media/memory/directory/ Code:
$ rsync -rLptDvu --delete /media/memory/directory/ /HDD/directory/ To fine tune: Code:
$ man rsync |
Quote:
eloi, thank you too for the replay! rsync is also a solution. Probably i should try that too assigned to shortkeys. |
@longus
Not sure if unison has daemon mode. I know it operates either from the console or GUI, advise you of potential conflicts and operate bidirectionally. rsync is good too but I don't think it helps in file conflict resolution and does not work bidirectionally. |
Unison is great - but quite complex to setup. I strongly suggest you look at the rsync tips above.
|
@Mark
Maybe I don't use it to its full extend, but I found Unison rather easy to set up. I found the wizard simple then after a set up I figured it is just a easier and faster to write my own prf files: Quote:
|
Actually it is quite simple to setup. I have tried it.
Well, one question remain. The usb stick must be mounted before starting the unison in XFCE, otherwise it cant fount the drive. I avoid the automounting in XFCE because it mounts my 3G modem as a storage drive. One more question. Does slackware-14 mount this usb stick on the same location in /run directory every time? Still searching something like daemon automatically starting the process of synchronization. rsync can't offer an option to control, i.e. to choose which file in which direction to update. |
Quote:
About "bidirectionally" the only I can say is that the rsync options I've used above respect modification time. So running both commands rsync will copy newer versions in both directories. Then if modification time is your interest and assuming the other machines you plug the usb memory use the same time zone and clock settings that two commands should do the job. Do not hesitate in telling me if I forget something. Four eyes see better than two :). Anyway, in general terms, if the flash drive will jump from some annoying OS to another worse I think, honestly, that sync *from* the flash drive is not advisable. |
@eloi :)
Simply means that if per example a file has gone AWOL unison will not know "which whay" the synchronize should be. So it will be to the user to decide what to do i.e. skip or restore at the destination where missing. Don't get me wrong, I use rsync if I want to move files in only one way, but I will use unison if I want to synchronize. It just makes me feel safer. And I only rsync/unison between Linux boxes... I stay away from OS that gets into my way :) |
Conflict resolution : There are several ways in which Unison can break. We use Unison to transfer files between 4 companies, across Windows, Linux and Solaris. We love Unison and would be hard pressed to get by without it. But even so, it does trip up over some issues, which are not trivial to solve. I'll describe some - they may not apply in your case. But do note that technically Unison is a distributed file system, with (relatively) high latency between updates. (in comparison to say a mirrored SAN disk system).
Case 1) User on side (a) updates a file and at the same time a user on suide (b) updates the same file. As Unison is essentially master-master, it can't decide which is the real "latest" file and even if it chooses (which it doesn't), someone will be unhappy. Case 2) Two files "aaa.txt" and "AAA.TXT" are created on Unix/Linux side and are synced to a single Windows machine - instant fail as Windows is case-insensitive. Now, if you're using a "simple" setup to your own USB disk, then chances are that you'll be fine. But be aware that there's more to Unison than meets the eye. |
Quote:
I've found this: http://superuser.com/questions/16631...omparing-files You could run: Code:
$ find /HDD/directory -printf "%P\n" | sort > /tmp/file1 But there is one more problem I can't think of an easy, practical solution, the rare case of files with same name, time but different content. Finally, I insist, even if you use it just on Linux boxes, rely on sync *from* a flash drive is not a good idea. |
All times are GMT -5. The time now is 03:44 AM. |