When I used to work in Windows regularly, I had a workflow of grabbing a file’s path by cutting and pasting the selected file’s path location inside Window’s Explorer dialog box. Then I would paste the file’s full path to a email or ticketing system to share the asset with other team members. When I moved over to the Mac, I decided to automate these steps to imitate this workflow.

At work, I routinely need to share the locations of files and assets with team members, and storing the complete file path is a good solution for sharing that information. One way to automate this task is to build a new OSX Automator service, throw in some Apple Script, and finally assign a keyboard shortcut.

To begin, please open Automator.app, located in your Applications folder. Then, select New Document, then Service.

Automator New Service WIndow

Next, set the “Service receives selected” box to “Files and Folders” and the “in” box to “Finder.app”. On the left pane, open “Library”, select “Utilities”, then drag “Run AppleScript” to the Workflow window.

Automator Full Screen Shot

Next, we are going to replace the placeholder code with the code below.

set path_list to {}
tell application "Finder" to repeat with filename in (get selection)
set end of path_list to POSIX path of (filename as alias)
end repeat
set text item delimiters to linefeed
set the clipboard to (path_list as text)

The Run AppleScript dialog box should now look like the screen shot below.

AppleScript Code Window

Now lets save (⌘+S) this new service as “Copy Path to Clipboard.workflow”.

To test, open Finder.app and select one or more files with the mouse. Next, press and hold the CTRL key while clicking the mouse to bring up a context sensitive menu. Slide down to “Services”, slide to the right, and click on “Copy Path to Clipboard”. The path to the filenames should be stored to your clipboard, ready to be pasted in an email, text file, or instant message.

To make this even easier, you can assign a keyboard shortcut to your new service. Open “System Preferences” and select Keyboard. Select the “Shortcuts” button, then select “Services” in the left pane. Find your new service “Copy Path to Clipboard” and press the “add shortcut” button to set a custom shortcut, such as ⌃⌥⌘C.

Happy hacking.

– Chris


  1. Window Explorer
  2. Stackoverflow Post
  3. ArsTechnica Post
  4. OSX Automator
  5. AppleScript