Shuffling files around with Dropbox

One of my abiding problems is how to easily and quickly transfer files between my two computers. For the past several years, I have used an iMac as my work computer, and a MacBook Pro for my personal computer. (This might seem silly to some people since I work at home, and the two computers literally live about six feet away from one another most of the time, but I can’t overstate how much this helps my sanity.)

Recently, the problem with moving files around has been exacerbated because my iMac is stuck running 10.6, and I need 10.7 to test Slicy, so I finally decided to hack something together to make life simpler. (I’ve debated many a time upgrading the iMac to 10.7, but given how bad a performance hit my newer and better-equipped-in-the-RAM-department laptop took when upgrading, there’s no way I would be able to squeeze acceptable performance from the aging iMac.)

After looking at various options, I ended up creating a little workflow using Dropbox and Hazel, because both are tools that I already use. My goal was to create a way to move files to a different computer with a single action without needing the other computer to be awake or on the same network, and without using up my Dropbox storage quota on storing temporary files.

A disclaimer: the following workflow requires two to three bits of software, all of which will cost you if you aren’t already using them: 1) Hazel ($25 at the time of this writing), 2) a Dropbox account with sufficient empty space to move arbitrarily-sized files around (free if you manage to get a ton of referrals, otherwise $100 a year), and 3) optionally FastScripts ($15 at the time of this writing) or some other way to quickly execute an AppleScript. Oh, and a Mac. You could do the same thing on Windows or Linux, but it wouldn’t be as magical without Hazel (unless you could find some Windows or Linux equivalent app).

Setting up

The first step was easy enough; in Dropbox I created one folder for my laptop and one for my iMac (“To Laptop” and “To Desktop”, respectively). Since I rarely access these folders directly, I hid them a ways down in the folder hierarchy in Dropbox to keep them out of the way.

The second step was to setup a Hazel workflow on each computer targeting that computer’s folder. Here’s the laptop’s version:

Hazel workflow

Basically, any time it finds a file in the “To Laptop” folder on Dropbox, it immediately moves it to the Desktop and colors it blue so that I’ll notice it more easily. (You can, of course, move the file anywhere you liked; the Desktop is just convenient for how I work.)

Third, I wanted to be able to send files between computers with a keystroke, so I hacked together a quick Applescript that would take the selected file(s) in the Finder and duplicate them to my target Dropbox folder:

-- CONFIGURE: Set this path to your target folder
set targetDropboxFolder to POSIX file "/Users/MYACCOUNT/Dropbox/Sync/To Laptop/"

tell application "Finder"
	set targetSelectedFiles to selection
	repeat with activeSelectedFile in targetSelectedFiles
		duplicate activeSelectedFile to targetDropboxFolder with replacing
	end repeat
end tell

To use this script, create a new script in AppleScript Editor (/Applications/Utilities/AppleScript Editor.app), paste in the code above, adjust the path to your target Dropbox folder, and save it either in ~/Library/Scripts/ or one of its subfolders.

Personally, I use FastScripts to associate a keyboard shortcut with the script, but there are innumerable other ways to quickly access AppleScripts. Alternatively, you could just create an alias to your “To Other Computer” folder, stick it on the Desktop or somewhere else easy to get to, and then drag and drop things you wanted to move across (just make sure to hold down the option key when you do, or the file will be moved to the other computer rather than copied).

Wishing for an easier way

In a perfect world, I would write an app to take care of this stuff for me instead of relying on a bunch of third-party apps and services, but I don’t really have time to devote to the concept. Ideally, I would prefer not to need to always route through the cloud; if I am transferring a file, and the target device is on the same local network, the file should just be moved across using the local network. For lack of a more elegant solution, though, this workflow functions well, was quick to setup, and has been making me happy. Hopefully it will help a few other folks, too, or at least sparks some ideas for easier transferring of files between computers.

3 responses to “Shuffling files around with Dropbox”

Leave a response

  1. Matt Pearson says:

    What I really like about this approach is how the various pieces are very decoupled. It’d be nice to have a single solution that’d make these things non-issues, but then we’d end up with a twisted brittle mess like Bitcasa that tries to do too much, and ends up doing some important things quite poorly. Instead of being likely to fail all over the place if (when) you replace one of the pieces, you’d have to do pretty much nothing to rip out Dropbox and swap in something like Sparkleshare, or SpiderOak, or anything else that correctly implements a shared/synced file system. Heck, you could probably even use Bitcasa in this flow, even though they don’t actually _sync_ anything (they merely privately cache files on-access and assume you’ve always got an Internet connection), as they’ve wired their “in the cloud” datastore into Finder’s view of your file system.

    The only real way I can see to improve on what you’re doing here in terms of “painlessly sync my world across multiple machines” is to implement basic version control & syncing on configuration/settings data… but that requires that app developers implement preferences storage in sane ways, which is a lost cause. See Ubuntu One’s mixed success on that front.

    And of course there’s the greater problem of moving data of non-trivial size, which even a Dropbox Pro account is incapable of handling, and where nothing but uncapped P2P connections could hope to be fast enough.

    My own far less elegant and far more manual solution to this problem is a combination of Dropbox and `rsync` to move data between machines, and SSH shenanigans to put remote files away in their homes. And by the power of Hamachi, I’m able to do things P2P between my boxes.

    So, taking your setup a bit further and making it more robust in terms of your underlying infrastructure… say there was a viable “decentralized Dropbox” utility. Swap out Dropbox, use Hamachi (or something more awesome) to handle rendezvous and get you a P2P VLAN, leave your Hazel watch-rules exactly as is, and accumulate even more AwesomePoints than you’ve already done so.

    And then of course make iOS not hate on daemons and otherwise bring the “mobile device” ecosystem up to snuff enough to play in this world, and do a victory dance. Easy, right? Right.

    • Ian Beck says:

      Yeah, the decoupling is a plus and a minus. Good that subbing in another method for moving the actual bits is super easy. Bad that there really isn’t a good possibility of P2P or other tricks for dealing with really big files.

      The Dropbox size limitation is probably the weakest link in the whole flow for me, but hacking together some method of checking file size vs. available space was way more work than I was willing to invest just to get things up and running.

  2. Matt Pearson says:

    I can’t vouch for its awesomeness, but Windows users can use Belvedere (http://lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc) as an equivilent to Hazel. I’m not sure what’s available for implementing your AppleScript’s functionality in Windowslandia, but there are probably innumerable combinations of batch/powershell scripts and global keyboard hook editors and other stuff.

    As far as *nix is concerned, there are probably a bazillion ways to do this.

    And of course, the Dropbox client is more or less the same on all platforms it supports. For the most part.

Leave a response