Link To Files On Shared Storage

Copy Path Banner

Link To Files On Shared Storage

Here at my day job, we use a shared NAS for our file storage. Telling people where they can find files was a huge pain, especially when giving one of our project managers a file path for a deliverable so they could get it to a client. We as editors spend all day in our file structure, but they don’t. Typing the file path out was a pain, so I eventually resorted to taking a screenshot from the Finder’s path bar and attaching that to the email like this:

Path Bar


Well, today I was checking out the trial of TotalFinder on the recommendation of several of my #postchat Twitter buddies. It has a great feature where you can copy the file path of anything in the finder in a URL format, so you can easily make clickable links to files. Very cool.

Copy URL


Now, I use Automator a ton, for everything from automating the making of our approval .html files using template code and a CDN link, to making file names web-safe by removing problematic characters, to launching several apps and windows as once for a specific processes. After seeing this feature in TotalFinder, I thought, “There has to be a way to do this with Automator.” The rest of my team without TotalFinder, as well as myself if I end up not liking it enough to purchase it, would definitely benefit from a feature like this. Well, a little bit of Google searching got me an answer!

Here’s how you do it. First, open Automator and create a new service:

Automator Service


Next, set the service’s input to: “Service receives selected files or folders in Finder. This tells the service when it’s available (i.e. this keeps it from showing up when you select text in an email, for example).

Files and Folders




Next, add a Copy to Clipboard action. This copies the file path to the clipboard in a normal colony (:) delimited file path format:

Copy to Clipboard


After that, add a Run Shell Script action:

Run Shell Script


Replace the “cat” in the text box with *exactly* the following (originally found here):

sed -e 's/:/\//g' -e 's/\ /%20/g' -e 's/^/file:\/\//g' | pbcopy

This code changes the mac file path to a URL type format that can be clicked on like a link:

Shell Code


For the last step, just save it with a name that makes sense:

Save As


If you followed these steps, you should see it on the bottom of the contextual menu when you right click a file or folder in the Finder:

Copy File Path


What you’ll be able to paste after selecting it from the contextual menu is a link formatted like this, that you can email, message, text, etc. to anyone who connects to the same shared storage:

File Path


When clicked (assuming the recipient is on the same shared storage), it opens a new Finder window at the specified path with the specified file or folder selected! I know this will make a big difference to our project managers, and a happy PM makes a happy team :)


  • Nicolas Duchon

    03.12.2013 at 13:09 Reply

    That’s why I really love OSX : unix tools under the hood. I’m constantly learning new tricks with the terminal, bash scripts and the various unix tools, but I could not have figured how to obtain this with sed myself (yet). And I wasn’t even aware that you could easily get bash scripting into aqua through automator.

    Thank you a LOT for this very nice idea and for the eye opening.

  • Darius

    14.04.2014 at 09:50 Reply

    I’ve always just brought up the info window to get the selectable file path, but this is an awesome method!

    • Aaron Williams

      03.05.2014 at 23:16 Reply

      Thanks! We use it daily in our office now :)

Chime in!