Two of my favourite Mac programs are Dropbox and Hazel.

Dropbox (http://www.dropbox.com) is a great file sync service (with version for Windows and Linux) that really has no peer.  Any changes that you make to files within your local Dropbox folder automatically gets synchronised to the Dropbox servers, and then synchronised down to any other machines that are linked with your account.  And it is super fast.  You can also access your files from the Dropbox website.

Hazel (http://www.noodlesoft.com/hazel.php) is an automatic file organisation tool.  You configure Hazel to watch certain folders and setup rules to define how Hazel will react to changes within those folders, and then specify actions to be performed when the rules are matched.  And these actions can include the execution of scripts that can be written in any language that is installed on the machine.

However if you pair the two of them up and you have quite a powerful tool.  Anywhere you are that you have access to dropbox (even if only the website) you can essentially upload files to a Dropbox enabled machine and have Hazel perform take action.  This is especially useful when you consider that it doesn’t require any special firewall or router magic to occur to get this to work since you are not directly uploading files, just indirectly by syncing with the Dropbox server.  Other people have paired Dropbox with OSX Folder Actions to achieve the same goal but I find Hazel much quicker to work with.

So today I built a online epub to mobi ebook converter with Dropbox, Hazel and Calibre.

Calibre (http://calibre-ebook.com) is an very powerful opensource ebook manager.  While it has a UI that only an opensource developer could love, it does also contain a great set of command line ebook utilities, including a format conversion tool.

What this setup gives me is a folder that if I copy an .epub file into it, the file will be converted into a .mobi file.This lets me easily convert books in .epub format that I buy online into the .mobi format that my Kindle can read.  And it lets me do it anywhere that I have access to my Dropbox.

What you need:

  • Calibre
  • Hazel
  • Dropbox

I installed all of these on one machine at home which is always connected to the internet and then performed the following:

  1. Created a folder in Dropbox, ebook-converter/convert
  2. Added that folder to Hazel and create two actions for it.

  3. The first action I called “convert epub to mobi” and it has one condition and two actions:
    1. Add condition:  if extension is epub
    2. add action run script with the following one line of script:

    /Applications/Calibre.app/Contents/MacOS/ebook-convert $1 ${1%.}.mobi 3. Add action: move file to enclosing folder

  4. The second action is called “move mobi files to parent”:
    1. Add condition: if extension is .mobi
    2. Add action: move file to enclosing folder

So when ever I have an epub to convert to mobi I can just drop it into the ebook-converter/convert folder, and a few minutes later the epub file and the corresponding .mobi file both pop up in the ebook-convertor folder.