Syncing your stuff with Dropbox
If you, like me, have more than one computer, you would probably like to have some way to sync files between them. There are of course numerous options for this kind of thing, and I haven't really looked at them all in detail, but I have settled for using a clever combination of
dropbox and
symlinks. It will sync your files with a minimum of effort required to set it up, no effort required to use, and, importantly, it will only occasionally corrupt your data. And probably not at all if you follow a few simple rules.
The first step is to download, install and register dropbox on all the computers you want to sync files between. Then, if you for example want to sync your Documents folder, you first move the entire folder into your dropbox. If you are on Mac OS X, this probably requires a bit of sudo, as the operating systems seems to like the Documents folder where it is. To compensate for this, you can then add a symbolic link from where the Documents folder would usually reside, to where you have moved it. Provided you placed your dropbox folder in your home folder, you can achieve this by writing
ln -s ~/Dropbox/Documents ~/Documents
You then have to repeat this procedure on any other computer you want to sync to, and your Documents folder should automatically be synced between them. Neat, but not very impressive. We want more. We want to sync the Address Book as well. I'm describing how to do this on a Mac, but the principle should be pretty much the same for other operating systems. First, we need to locate the file which actually stores the data kept in your Address Book. On OS X, this is stored in ~/Library/Application Support/AddressBook. I don't know exactly which file, so I copied the entire folder to my Dropbox. It is probably a good idea to close the Address Book (and Mail, which uses the Address Book) before doing this. I then created a symlink pointing to the folder in the dropbox:
ln -s ~/Dropbox/AddressBook ~/Library/Application\ Support/AddressBook
Repeat the linking on your other computers, and any data you add in your Address Book on one computer should show up on the others as well. You can also sync for example your iCal in the same way.
Now, what was that I said about corrupt data? Well, syncing normal files between computers works pretty well, even when both computers are on. Delete a file in your dropbox on one computer, and seconds later, it should disappear on your other computer, with a message that it was deleted from elsewhere. This is ok, as the operating system is used to programs modifying files. What is not so good is if you have the file open on both computers, make some changes, and then save from both computers. That might lead to fuckup, and that is precisely what will happen if you modify your Address Book on one computer, while the other computer is running either Address Book, or another program that uses Address Book. Usually, what will happen is that Dropbox will detect that something is amiss, and save two versions of the file containing the data, and one of them with a helpful name like this
AddressBook-v22 (mini's conflicted copy 2010-04-07).abcddb
So you probably won't lose data, but it won't work perfectly either. The only file I have lost to my syncing project was a disk image file which I had mounted on one computer, and then made changes to it on another. I don't know if there is anything special about disk images, or if it was just bad luck, but after I started being more careful, I haven't had any problems. I just make sure I'm not logged in to both computers at the same time, which is not a problem since one is in my office, and the other isn't, and everything is fine. Also, note that logging in remotely doesn't (by default) cause Dropbox to start running, so that is also ok.
-Tor Nordam
Comments