Subscribe to MacYourself via RSSSubscribe to MacYourself via EmailFollow MacYourself on Twitter
Apple Products and Accessories from

Copy file or folder path to the clipboard in Mac OS X Lion

Copy file or folder path to the clipboard in Mac OS X Lion

Learn how to create your own OS X service that lets you copy & paste the paths of files and folders in Finder. After just a few steps you will be able to select items in Finder, press a quick keyboard shortcut, and paste the path(s) anywhere you want.

Mac users have long complained that there’s no easy way to copy the location of a file or folder on their computer and paste it in a document, email, internet browser, etc. There are a bunch of third party utilities and convoluted workarounds to get this functionality, but let’s be honest – they’re all pretty terrible. Even MacYourself’s clever workaround from 2009 doesn’t work anymore in OS X 10.7 Lion.

So what do we do? We take matters into our own hands, of course! Let’s come up with our own solution – and let’s make it awesome.

Before we get started, we should establish some goals. Obviously we want to copy a file path or folder path from Finder and paste it somewhere else for reference. Let’s take that a few steps further and say we want to:

  • Support the selection of multiple files and folders at a time
  • Require no third party software or plugins to accomplish our goal
  • Integrate with Finder so this feels like a real, native solution
  • Set up a keyboard shortcut for quick & easy access
  • Copy the path to OS X’s clipboard so it can be pasted in any application

Sounds like a plan! Here we go…

  1. Launch Automator from your Mac’s Applications folder. If you’ve never used Automator before, that’s not a problem. This is going to be so simple anyone can do it.
  2. Double-click the Service icon from Automator’s start menu.
    Copy file path to clipboard in Mac OS X 10.7 Lion
  3. Toward the top of the right column, you’ll see this line of text: “Service receives selected _____ in _____”. Choose “Files or Folders” from the first menu and “Finder” from the second.
  4. Next, click on Utilities in the Actions library on the left side. Double-click “Copy to Clipboard” in the middle column. You’ll notice that this action has been added to our workflow on the right.
    Copy folder path to clipboard in Mac OS X 10.7 Lion
  5. Go to File > Save in the menu bar and name your service Copy File Path. Our work with Automator is now done, so you can safely quit it once the service is saved.
  6. Launch System Preferences and go to the Keyboard pane. Click on the Keyboard Shortcuts tab.
  7. Select “Application Shortcuts” from the list on the left. Next, click on the + button at the bottom of the list.
  8. A small window will come up with a few options that need to be set. Select “Finder” from the Application menu, type Copy File Path as the Menu Title, and create your own Keyboard Shortcut. If you don’t know what to put here, you can just press Shift+Command+C on your keyboard. Click Add and we’re done!
    Copy file path to clipboard in Mac OS X 10.7 Lion

Now let’s test our fancy solution! Here’s how it works…

  1. Select any file or folder (or a mixture of multiple files and folders at once) in Finder.
  2. Press your keyboard shortcut – in our case, Shift+Command+C. This copies the path to OS X’s clipboard.
  3. Open a text document, email message, or other place you’d like to use your location path. Press Command+V (or right-click and select Paste) to paste the file path(s). Hopefully you should see something like /Users/YourName/Documents/Work/Files/resume.doc

From now on these 3 easy steps are all you have to do to copy and paste file paths from Finder to your clipboard and, ultimately, another application. Pretty cool!

A few things to mention… If you’re not keen on keyboard shortcuts, the service you created is also accessible when you right-click on an item in Finder and select Services > Copy File Path from the contextual menu. The actual file we created for this service is located in: ~/Library/Services in case you ever want to delete it or copy it to put on another Mac. Finally, this tutorial was written specifically for Mac OS X 10.7 Lion, so the steps involving Automator might be a little different if you’re running an older version.

How does this solution work for you? Does it give your Mac the functionality you were looking for?

78 Comments Have Been Posted (Leave Your Response)

Folks, I want to use the path I copied to the clipboard and then use it to save another file I have newly created. How do I do that?

Unfortunately, there is no easy way to do what you’re asking. One option, though, would be to open the Save dialog box for your new document. Then, in a Finder window, drag the file with the path you want to copy, and drop it right on top of the drop-down menu that contains the folder name in the Save box. Does this make sense? Hopefully I’ve explained it in a way that’s easy to follow.

I’ve been looking for such a clean solution for a while…
Very cool and works like a charm!
Many thanks

Works great, thanks a lot!

That’s really great! Very useful and totally simple!

There’s just one thing… it doesn’t work when you select only one folder. In this case, the service is not available 8-/

Any ideas why?

Best regards

Thanks for pointing this out! It looks like the keyboard shortcut works for one folder when it’s on the Desktop, but not in a Finder window. You can still right-click the folder and select the Copy File Path service from the contextual menu, though.

Hi Ant,

yes, right-click works. Well, not too bad.

Many thanx!

There are contextual menu items that do this very easily and can copy the path in different formats: Unix, HFS, url, etc. Search copy path on Macupdate.

is there a way so that the file name is included in the file path?
even if not, this is great, thanks!

@Keksi @Ant
I was having the same problem and Keksi’s note made me realize that it likely doesn’t copy a folder path when your window is displaying as columns because the focus changes to the contents of the folder (with no file selected). That said, the keyboard shortcut still works fine in icon or list view.

Excellent ! I finally can use my storage partition and knowing where to re-direct to my specified folder

Recognizing that this is for OSX.7, in 10.6 what I get is this kind of path:
Macintosh HD:Users:phil:Library:PubSub:

I dont get one with the slashes in it. The path with the colons isn’t recognized, by Word 2008 at least.

Jeffrey Jorgensen
April 11th, 2012, 8:29 AM


FIIIIIIIIIIIINNNNNNAALLLLLLY. Thanks for sharing this. What an elegant way to achieve this.

But is there also a way to get the “server Path” (see Information of a file. There is “Location” and “Server”)?
If I want to send a filepath to my colleagues, then they need the server path and not the path with “/Volumes” in the beginning …

Works like a charm – many thanks!

Works great and very simple. glad i found this.

Sublime! Thanks !!!

what if i only need to copy the list of files selected and not the entire filepath? i imagine it can also be done in automator but i haven’t figured out how

This works well, thanks!

There’s one minor problem. Using the shift+cmd+C shortcut works when a file is selected, but it doesn’t work when a folder is selected. Right clicking the folder and manually pressing “Copy File Path” does work, however.

Ant, Re your comment from January 1, 2012:

“Unfortunately, there is no easy way to do what you’re asking. One option, though…”

That IS an easy way!! Thanks a lot for sharing this!

@Dimitri: That problem only occurs in column view. For every other view it should work as expected.

Nifty. A requested improvement: copy a directory name.


Here’s an easy way to get a SLASH separated path instead of a COLON separated path.

Add “Run Shell Script” before “Copy to Clipboard.” It can be found under the Utilities group. Use the following shell script and viola!

sed -e ‘s/”/\//g’

Here’s a screenshot.

EDIT: No need to use…

sed -e ‘s/”/\//g’

…you can just use…


…it seems just passing it through sed is enough to force using slashes. Probably is a more “correct” way to do it, but whatevs.

Thanks so much for this. I’m a windows user who just started using a mac at home and this is by far one of the most helpful tools I’ve learned.

Huge thank you for posting this tip! It has long bugged me in OS X that copy path wasn’t there, especially as it WAS there in previous versions of Mac OS, i.e., OS 9

You said that the tip was written in Lion – 10.7. I’ve just accomplished the task in Mountain Lion – 10.8.0 – with no problems encountered along the way.

Next thing is to try it on my older machines which are running 10.5 and 10.6 …

Thanks for the tips. Unlike others, I can get this to work.

I can copy the file path ok, but then when I paste it into a document or email message and try to click on it, I get an error. In an Outlook message, it opens Safari and doesn’t work. In Word it says an unexpected error has occurred. Any ideas where I’m going wrong?

I am also wondering the same as Marcel about sending documents from a server. But better to get it working first I think!

Thanks all

Was there an answer to Marcel’s Q?

But is there also a way to get the “server Path” (see Information of a file. There is “Location” and “Server”)?
If I want to send a filepath to my colleagues, then they need the server path and not the path with “/Volumes” in the beginning

Thank you so much. Up & running & working perfectly in Mountain Lion in a couple of minutes – I mean perfectly, including slash codes, folder vs file selection etc.. I’ve been wanting something like this for years now, don’t know why it’s not built in to Mac OS. This is wonderful.

Thanks guys, this is exactly what I was looking for. I’m new to Mac as of June this year and while the love still flows, it’s the little things in a relationship that eat it away. This problem is now gone and I can move on.

Awesome! this will save me sooooooooo much time writing out paths!

Thanks for this great solution. But really instead of giving us silly improvements in mountain lion like share with facebook or twitter from safari they could put features like this one that is actually useful.

Anyway love your work!

This works great if you have a file to select in that folder, but what if you a) don’t want to copy the filename(s) or b) the folder is empty? Is there a way to make this copy the folder path if you don’t have a file selected?

Great work. Thanks for the tip!

You are awesome! I love the fact that “Copy File Path” option became available when right-clicking after doing what you described, although the “shift+command+c” keyboard shortcut does not work for me. Thanks!

This is great and your instructions are excellent ! Thanks for taking the time to post this information.

YESSSS! Thanks a million! Wonderful directions

Fantastic Service! Thanks. It did just what I was after.

Is there an automated/easy way for the person receiving the path to go to that file/folder?

A great help, thanks!

Awesome tip. I have been annoyed by not having this by default. Thanks a lot.

You are the best person ever. Thank you. You just saved me literally hours of time for a project I need to do. THANKS!

Works, but I am still unable to connect to the shared drive/folder of another server.
Mac to PC connection, PC to Mac email sent with hyperlink to file on shared drive of Network Server.

Ant- What Marcel & Phil said… would love to know the answer to this!

But is there also a way to get the “server Path” (see Information of a file. There is “Location” and “Server”)?
If I want to send a filepath to my colleagues, then they need the server path and not the path with “/Volumes” in the beginning.

This is great, but is there a way to hyperlink the text? I’d like to be able to send somebody a hyperlinked filepath for our shared server so that he can just click the filepath and automatically open the file in the filepath. Thanks.

Jesse- Typically it’s Command K for most apps. Works in Mail, Outlook for Mac, iChat, Adium (although you have to give it a unique name), etc. Great way to share links that aren’t stored on a server. For sharing server-level files, the only thing I’ve come across is Command i the file, then triple click the server path (not the “Where” path), Command C, Command K, Command V. Done. Pretty painless.

i’m copying multiple files and trying to insert in excel for mac 11, its only copying one at a time (even though i’ve selected about 100 ) help!

Thanks a lot
Clear, accurate, and concise…and it works!

Thank you for your awesome discovery, and also the amazing way you taught this. Fantastic tutorial!

I want to prepend “file:///” to the file (as a separate service), this is useful if people want to link to a local file in something like Evernote :-)

Automator is amazing!

Thank you very much for this article! I am now wondering (perhaps I missed something in the comment thread) if there is a way to actually hyperlink the file path in an email. For example, I would like to send the file path as a link to a co-worker to open the actual file in our company’s shared drive. I thought I just would copy the file path and input in in the hyperlink area (in 2011 Microsoft Outlook for Mac). However, when the hyperlink is shown as a clickable link in blue, I try clicking the file and nothing actually opens.

Is this possible?

^ Never mind – I figured it out!

Brilliant!! Thank you so much!

Thanks a lot. Works great.

I’ll start using Automator way more !

brilliant! thank you! thank you!

Works pretty nicely. I found that if you need the directory, select a file within the directory and use the shortcut you created, paste where you need it, and just delete the file works well (although, a little more inconvenient). I haven’t the time to figure out how to do it right.
It’s interesting that whatever file you last selected (and path copied to clipboard?) is what is pasted even if you select another directory (not a file) and use the keyboard shortcut. I haven’t tried the Services menu.

it does copy all the files if i have selected more than one file. i’m in the icon view in finder. if i select file 1, it copies that path, file 2 it copies that one. now if i select file 1 and file 2 it only copies file 1

Shift Command G in the save as/ open file dialog shows the Goto folder, do not need to drag and drop it.

How about when there are spaces in the path? On Windows, I can start the path with a quote(“) and end with a quote and it makes it a hyper link. Any suggestions?

This is EXACTLY what I wanted!! Thank you SOOO much!!!

Thank you. Can’t tell you how much I appreciate a quick and clear solution. You Rock!

I can’t seem to get this working if there is a space in directory path, eg

/Users/johnq/Documents/A new approach to getting fit.xmind

doesn’t work but but it works fine with


I have tried adding this sed script to replace the space with %20 but it doesn’t work – any thoughts?

sed -e ‘s/[ ]*/%20//g’

Dude.. A miracle, that’s exactly what I wanted!

yo – this is great but can you please answer the question of getting the Server Path? this works fine for the Volume path but you can’t send those for someone sharing a network to click on and get the file… you need the AFP or Server path!

It works!
Thanks for sharing with us! :)

This works and combined with cmd-shift-G lets me paste a file path in a good enough way.

This should be standard of course, like it was in XP. Microsoft don’t get EVERYTHING wrong. They just tend to change the stuff they get right in the next release!

This is the best post in the history of posts. Thank you, thank you, thank you.

Or you can hit command+i with the file selected and copy the path under General –> Where.

[…] Setting this up is a bit more complex and requires the first 5 steps from Copy file or folder path to the clipboard in Mac OS X Lion | MacYourself: […]

Thank you for this great, detailed tutorial!!
I have the same question as Mike’s

I want to prepend “file://” to the file path, I guess I need to deal something with “Run Shell Script”? so I can set up another shortcut to copy the file path as “file:///Users/jMara/Documents/Doc1.doc”.

Please help me with this!!! Thanks again!

This is fabulous, Although the key “command+shfit+c” does NOT work for me, the “copy file path” option appears under “services”, when I simply right-click on the file name, in the Finder window.
Thank you so vey much for sharing.

Its really awesome. Thank you very much

This was the first time I felt capable as I got it to work in a plain word doc as I tested it! THEN… I went to my project and tried and now –lost.
Here is what I’m trying to get done:
I have a document that I actually send to clients as a PDF when it’s completely ready. Inside that doc is a schedule of activities that I want to have people be able to click for the details and instructions of that activity, ie. “Warm UP” then when they click it, it shows that plan in PDF form. When they click “MAIN ACTIVITY” then my pdf comes up with that specific page… Do I hightlight the name of the activity, then ‘hyperlink it’ then paste the path? WHat if the name of the activity is not my name like it came up when I practiced your steps?

thanks for the advice. it’s great but when I try to open the link, rather than opening the file I want, it tries to open it as a web page in chrome…am I doing something wrong? Many thanks!

spaces and other reserved characters like & need to be prepended (escaped) by a \ (backslash) e.g.

/Volumes/My\ Data/random_stuff_\&_research

a server volume needs to be mounted before you can use the path above, I’ve used a shell script –
# create mount dir
mkdir /Volumes/MyData
# mount MyData to mount dir (replace user, pass and server or leave out user/pass for guest connection)
mount_smbfs smb://user:pass@server/MyData /Volumes/MyData
# open folder or file
open /Volumes/MyData/random_stuff_\&_research

Alternatively, use an alias

Create an alias by holding cmd+alt+shift and then dragging the folder/server to your Desktop/Documents/… – you can then use the alias to mount the server volume.

Leah – if you’re linking to inside a pdf, you’re in the wrong place, use google “link inside pdf”. If you’re linking to other pdfs, you can get the path of the other pdf as described, but this may not work on other filesystems (and I’m not sure how to do relative paths).

Long Path Tool works well to copy or delete long path files, you may use it and I m sure you will love it.

Ant, great post – thank you for taking the time. I am having trouble with using this for multiple files (3-10) and pasting on Excel. Excel does not accept the contents, Word appears to complain that not enough memory space is available and Text Wrangler is only taking the first link. Ay suggestions?

Still works for Mavericks OS X 10.9.5. Thanks — that was easy.

If you want to use it in Evernote, use the Copy File Path on the file, then simply click on your note, use the shortcut command-k (which you also use to paste website URLs), and paste the path in the box. For Evernote use, you’ll need to insert File:// in front of the path (no spaces). This will OPEN the file.

If you just want to see the file in Finder then Copy File Path for the folder containing the file. Same procedure, and again, insert File:// at the start. I suppose there’s a way to use Automator to get the File:// inserted automatically, but that’s for after this report is done!

Thanks again. Very clearly written, easy-to-follow steps.

PS Evernote generates a security warning when you click on your link — just tell it Okay after checking Don’t Bug Me Again.

It runs!. Perfect I’m very grateful

This is a big problem. This type of long path problem can be solved by using Long path tool.

Have Something To Say? Join The Discussion!

  (required; will be kept private)