Copy Finder Path to Clipboard – Tip 1

March 27, 2008

I’ve written a short script that I’ve found more useful that I ever anticipated. It is nothing more than an AppleScript application that copies the current path of Finder to the clipboard. Sounds rather unassuming, however, I think you’ll be surprised how handy it is.

The AppleScript code is less than 10 lines that instruct Finder to get the path of the front most Finder window and copy the path to the clipboard.

Script Editor Click here to paste the code below into the Script Editor

  tell application "Finder"
    set currentPath to (POSIX path of (target of front window as alias))
    set the clipboard to currentPath
  end tell
on error
  display dialog "Unable to copy a path to the clipboard.
                      Make sure Finder is referencing a directory/folder
                      within the file system."
                      buttons {"Ok"} with icon caution with title "Error"
end try

From within Script Editor, save the code as an application and then drag/drop the application to the toolbar in Finder. The screenshot below shows the Script Editor icon in Finder (to the right of the terminal window with the green arrow), where it is now one click away.

There is a trivial amount of error handling in this short script. If you try and run this script while Finder is referencing the system (as compared to a directory/folder on the system) you’ll get the following error message.

In the next tip of this series we’ll drill down one level further and I’ll show how to copy the path of a selected folder within the current Finder window, to the clipboard.


Wow, that was simple. Thanks for the Apple script tutorial and thanks for bridging an Apple annoyance gap that I’ve had since forever.

by Matt Platte on Mar 28, 2008 at 6:26 am. Reply #

No problem, Matt, glad you found it helpful. Check out Tip #2 (the next post) that supports dragging and dropping a folder onto the script/icon…

by john on Mar 28, 2008 at 6:33 am. Reply #

Great! I´ve been looking for something like this. In Windows 2000 and newer one is able to copy/paste addresses in Explorer (the Windows-equivalent to Finder). I use that all the time and having to click around in OSX is extremely annoying. Somebody should make a whole archive of useful scripts like these. :)

by PC-Bjorn on Oct 2, 2008 at 7:10 am. Reply #

Fantastic – have recently been using the terminal window a lot (playing with MySQL & other command-line software) and this has solved a major annoyance. It was the one tiny area where I thought that Windows had won the battle for usability. I can’t imagine why Apple haven’t included this feature as standard. Thanks very much.

by Jen on Nov 17, 2008 at 9:06 am. Reply #

Jen, have you tried drag’n'dropping to the terminal window?

by Meth on Dec 11, 2008 at 10:38 pm. Reply #


How to make it so I can automatically run the script without having the “Run Script” dialog pop up.

How do I customize the icon?


by Patrick Lemiex on Jan 11, 2009 at 1:21 pm. Reply #

Thanks very much, this is really very useful. Especially since I have been trying to copy directory paths using my tablet and there is a delay in selecting each individual folder hierarchy. I no longer envy pc copy and paste directory.

by Maria on Sep 22, 2009 at 6:04 am. Reply #

this is really helpful. Many thanks

by siti on Jan 19, 2010 at 9:51 pm. Reply #

It’s really helpful. Thank you very much. I really appreciate it. This simple tweak can really make saving files process much more easier.

by Guntar on Oct 9, 2010 at 7:32 am. Reply #

That is really what I want! Thanks a lot!

I will try to learn more about AppleScript.

by Tong on Dec 3, 2011 at 1:18 pm. Reply #

Post a comment:


Required. Not published.