How to easily copy the path of a file
Mac Tip #465, 01 December 2010
A mailing list buddy had a problem: she often had to store files on a shared drive and then email colleagues telling them where the file was exactly. She needed to send the file path
. While it’s easy to see where a file is, it’s not easy to add that information to an email. Here’s a solution that takes the pain away. The Service I talk about is available for you to download — read on.
Please subscribe to the MacTips channel. Or just visit this video on YouTube, leave comments and rate it, as that helps spread the word about the MacTips.
Show the Path Bar
My Tip, View the Path of a File, explains how to see where a file is, by making sure the Path Bar is displayed.

This file is folders deep on an external hard drive.
In my screenshot here you can see that my Arts blog
file is on an external Hard Drive named Pleiades
inside a folder several folders deep. The file path
is: /Volumes/Pleiades/Users - still a backup/miraz/Documents/2007/me/Arts-blog-interview 20061015 1249.1.mp3
.
That’s definitely not the kind of thing you want to type in from memory — especially if you have to do it for numerous files, multiple times per day.
Applescript to the rescue
Another member of the mailing list quickly provided a couple of Applescripts that easily put the file path on the clipboard. That’s fantastic, if you know how to run Applescripts.
I have several articles about Applescript intended for total beginners:
- Newbies Guide to Applescript (at my KnowIT blog);
- Applescript 101;
- Applescript 102;
- Applescript 103.
Two click Service
In the interests of making the script below easier to work with I turned it into a Service, and have Michelle’s permission to offer it here. After you download the file, double click to expand it, then follow the instructions below.
Install a service
Put the expanded file (Put multiple file paths on clipboard.workflow
) in this folder: /Users/[your username]/Library/Services
.
Use a service

I choose the Service from the Contextual menu.
To copy the paths of one or more files:
- Select one or more files in the Finder.
- Go to
Finder - Services - Put multiple file paths on clipboard
(or use a keystroke, orControl (⌃)
click on the file and choose the Service from the Services portion of the Contextual menu that appears). - Open your email or other document and paste in the file path from the clipboard as required.
Stop here, or read on if you’re interested in the actual Applescripts Michelle provided.
Copy the path of one file
Michelle’s first script allows you to select a single file. Run the script and it copies the path to the clipboard ready to paste into an email or other document:
tell application "Finder" to set the clipboard to the POSIX path of (the selection as alias)
Copy multiple file paths
If you have many files, you don’t need to copy the file paths one by one. Instead Michelle provided this script which works with one file, or many:
set the_items to {}
tell application "Finder" to set selected_items to the selection as alias list
repeat with i from 1 to count of the selected_items
copy (POSIX path of (item i of the selected_items)) to the end of the_items
end repeat
set text item delimiters to return
set the clipboard to the_items as text
Keyboard Maestro
Even easier than using a Service is to add one or both of the above scripts to Keyboard Maestro and assign a keystroke.
My thanks to Michelle Steiner for allowing me to use and write about these scripts. Tell us in the Comments how you’ve used this Tip.
Simply Drag the file into a text editor, it will give you the full path for that file.
Great trick! Thanks.
Hey, works great, however I would love to use this to make clickable links for other people. Problem is file path often has spaces in it. If I change spaces in for %20 then it works. Is there a way to add that to the code? (I am tech savvy but not apple script savvy, but if there was a line of text I could probably add it to the script.) Thanks, it works great other than that though!
(Lion 10.7.4)
Hey
Does this work in lion as well? I cannot get it to work.
Thanks
It works for me in Lion. However, when using the “Paths of multiple files to clipboard” script, the selected files all have to be in the same folder. I don’t remember whether or not that was the case with OSX prior to Lion.
Jim emailed:
Mac Tip: If you would like to copy/paste the path of a file (a bit more work on the mac side) try this.
In Mac OS 10.5.8
1. Highlight the file
2. Under “Finder” choose “Services” , then “Summarize”
3. You will be provided with a text pop up with the file path so you can copy/paste into any file
Jim
Thanks so much! I’ve been wanting this capability for a long time. I thought that surely the ability to put the path of a file into the clipboard would be a standard part of the Mac operating system, and so I kept looking for it sporadically over a long period. I’m flabbergasted to find that this feature is missing from the OS.
Thanks for the feedback Rusty. It’s rewarding to know the Tips have been useful.
I downloaded the script and it works very well. Thanks a lot.
I love your site and this would be a great bit of functionality… I don’t however have a “services” folder in user/[my name]/library. I do have a services option in Finder under file>services. Any idea where else I might find where the “services” are being kept? I’m using version OSX 10.6.5 on a MBP 13.
J-wah, you may need to create that Services folder in your user Library. If you don’t already have any other custom Services the system may not have created it.
There’s another Services folder in the System library that will include items installed by default.
Aha! It works perfectly. Thank you!
Glad to hear it. Thanks for letting us know.