File Sync with Portable USB Drives

Portable USB drives (loaded with flash memory from 64MB, 256MB, and up) have become quite popular and are really handy for carrying files or data around with you. I've started carrying around a 64MB drive from Jungsoft, keeping with me several files that I'm working on. It saves the trouble of emailing files to myself or burning CDs.

What would really be useful is a way to “synchronize” the files quickly with whichever PC I'm working with. I'd like to be able to plug the drive in, sync, do my work, then sync again when I'm done. The tool should automatically copy the latest of each file in the right direction.

I looked at using Windows' Offline Folder Synchronization feature, but it appears to only work for true network drives. I also looked at Briefcase, but I've had trouble making that work in the past and it seems flaky.

Instead, I came up with my own solution using Unison:

Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

Unison has an added benefit of working on Unix/Linux as well as Windows, so it can be a cross-platform solution. They have some support for Mac OS X, but it doesn't yet handle resource forks so it's probably not viable for Mac users.

Unison comes with an excellent manual and is pretty straightforward to set up. Basically you run Unison from the command line, giving it the two locations (directories) you wish to sync. There is also a third location where Unison stores its data files to keep track of file modifications. For my application, I set up one location on the PC (in a desktop folder), then the other data location plus the Unison data are on the USB drive itself in two separate folders. I put the Unison executable on the drive itself along with a simple batch file. (_Update 2003-01-08:_ For times when I need to manually resolve file conflicts, I've created an 'interactive' batch file as well.)

Now I just plug in my USB drive, run the Sync.bat file to synchronize, and I'm all set. Being a command-line tool, it's a little rough around the edges. A nice, simple GUI application would be a good improvement. Also, this solution won't sync files that have been modified on both sides; these need to be resolved manually.