How to create Persistent File Links from Evernote to the Filesystem

So I’m playing around with Evernote and essentially don’t want to use Evernote as my “store it all” kind of document repository. DevonThink didn’t work out that well after all, and using Evernote that way seems to be equally inadequate. At the end of the day, I have a decent file system anyhow, so why should I decide to move all my files over there. Rather, I’d use Evernote for notes and stuff, as the name suggests.

One thing I like about Evernote is, of course, that it has files available on all devices. So one thing I’d like to do is to have things like the invoices I’m currently paying being in Evernote, while at the same time staying in my existing file system structure.

Therefore, I thought about setting up a folder which I anyway have and where I normally dump into all those invoices that I’m having to pay. My idea is to add some handler to that folder so that

  1. Whenever a file is added to that folder, it should be copied into some Evernote notebook
  2. Along with the actual file, I want to have a hyperlink in the Evernote note that will open the original file from the file system – thereby I can easily add comments to the file like “paid”
  3. When I eventually move the file from its original location to some target location in the file system, I want the link inside the Evernote note to still be pointing to the file – regardless of where it actually is (on the local file system).
  4. Obviously, I want the whole process be fully automatic – in other words, it should suffice to just drop a file into the folder, and I should never have to edit the hyperlink inside Evernote manually.
  5. Should I share the notebook, I don’t want those hyperlinks in those notes reveal any relevant information about my local file system structure.

Now having said that, this is obviously not only about some invoices, but it allows me to hold notes in Evernote notebooks (which I may also share), while at the same time being able to maintain my local file system structure, backup processes, etc. I just add Evernote on top, without losing control over the files. On the downside, whatever I add to Evernote will actually be stored twice (in Evernotes file repository as well as in the file system where I control it).

OK, so how do I achieve it? Using a simple Apple Script (see below) – and attaching that script to the folder using Hazel; I also use, optionally, Growl (automatically detected whether it is running by the script). Please bear with me – I significantly suck at writing Apple Script, so I’m pretty sure that any 9 year old can do that better. Yet it seems to work, so let’s go for it…

Now, I attach this script to my target folder using Hazel, like so:

Bildschirmfoto 2016-01-13 um 20.39.27


In the above I reference the script and also have a condition that I only want to use it for PDFs – that’s of course something that you may want to change. Similarly, what you see at the top of the script itself is that I set the name of the target notebook to “Rechnungen” (German for: “invoices”). That equally is something you may want to adapt.

Next, when I run the script, i can see that the file appears in Evernote:

Bildschirmfoto 2016-01-13 um 20.39.45



Notice that at the top of the file, i have a hyperlink. When I go there with my cursor and hit Cmd+K for editing the hyperlink manually, I see something like this:

Bildschirmfoto 2016-01-13 um 20.40.05

As you can see, there’s only a numeric ID in the link, which works on the local file system without revealing further information; the file system in turn will keep track of where that file actually is, so that if I move it around, the hyperlink still works.

This link is so persistent that I can even move the file around from the command line, in other words, it’s perfect for my purposes.

Note: Apple says that “although they are safe to use while your app is running, file reference URLs are not safe to store and reuse between launches of your app because a file’s ID may change if the system is rebooted,” I haven’t had that problem yet. So for my purposes, it seems to work well.


This post currently has one response

Leave a Reply

Your email address will not be published.