Mar 27 2008
Copy Finder Path to Clipboard – Tip 1
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.
Click here to paste the code below into the Script Editor
try
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.
Tips by RSS
Tips by Email
Wow, that was simple. Thanks for the Apple script tutorial and thanks for bridging an Apple annoyance gap that I’ve had since forever.
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…
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. :)
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.
Jen, have you tried drag’n'dropping to the terminal window?
Question:
Great!
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?
Thanks,
Patrick
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.
this is really helpful. Many thanks
It’s really helpful. Thank you very much. I really appreciate it. This simple tweak can really make saving files process much more easier.
That is really what I want! Thanks a lot!
I will try to learn more about AppleScript.