Copy File Path to Clipboard

18 01 2009

While chatting with a friend recently about copy and pasting file lists, he mentioned a quick and simple way to copy the file path of a folder or file to the Clipboard within Mac OS X.

This easy method involves the Services menu within Finder.

Now, I don’t know about you, but I seldom look at the long list within the Services menu and even if I had gone searching through Services, I doubt I would have recognised the option that actually performs the task of copying a file path!

Once the required Service is pointed out, it all becomes so obvious:

First select the file or folder whose path you wish to know, then within the Finder menu click Finder > Services.

filepath4

Towards the end of the long Services list choose TextEdit > New Window Containing Selection. 

filepath6

 

 

 

 

This opens a new TextEdit window with the file or folder path already pasted in and hyper-linked to the object.

 

 

 

 

 

 

filepath2

 

To remove the link from the text just Ctrl-click or right click on the link and choose Edit Link.

A new window opens enabling you to delete or alter the link.

 

 

I did a little further Googling into the subject and found there were various ways to achieve a file path, including dropping the file on to an open Terminal window, using TextWrangler, AppleScripts and Automator.

There are a few free and paid utilities that provide a contextual menu option allowing you to copy the file path to the clipboard. These include FileXaminer at US$10 and the freeware utility FileUtilsCM from Abracode.com.

FileUtilsCM installs a Finder plug-in which provides the ability to set different file or folder attributes. Amongst the various options offered by a Ctrl-click or right click on the selected file is Copy Path To Clipboard. 

fileutilscm-shot

 

 

So there you have it, a few alternative ways to get your file path copied to the clipboard and into a text document. No doubt there are a few more examples of how to achieve this, if you know of any, then please share the knowledge with us all by adding a comment below.


Actions

Information

9 responses

18 01 2009
Gazmaz

Good one Jane it wasn’t until I read this blog that I realised that I needed this option.
So watch out or you could become the blogging version of Don McAllister :-)

Thanks nice one.

18 01 2009
Paul Shadwell

I read this and thought… wait but can’t you do this via the Info option when you right click a file or folder? Turns out, no. You can view the path but there’s no ability to copy and paste it. (you can do that in Winodws BTW). So then I thought no, what about if I….. nope that doesn’t work either. Turns out your method is the only way other than using 3rd party apps.
Damn, I hate it when somebody outsmarts me. Now I come to think of it, that’s a lot of hate. I should get that seen to.
:-)

18 01 2009
Rob Hanson

Nice tip Jane! Just the kind of helpful hint I like to give on switchmac.com – I might just mention the ‘problem’ and point people to your solution, if that’s ok?

If you find any more useful stuff – let us know!

Wiz,
SwitchMac.com

23 01 2009
Ohm51

I arrived to your tip via a google search for how to copy the File Path onto the clipboard as I’m trying to compare files on my boot-drive with a cloned back-up. You tip made this much simpler process as it automatically pastes it into a Simple Text document.

Wait a minute …. something’s not right … its NOT actually pasting the Path for me … its just copying a generic icon of the file itself and no hyperlink. WTH? Perhaps this is only available in Leopard?

I’m running in Tiger 10.4.11 … Oh well, it looks like it’s back to the drawing board for me.

I did like the piece explaining Twitter … as all of the Tweets I’ve looked at before all seemed endlessly repetitive and completely perplexing to me. Now I get it … I think.

Nice web design on your page btw … no flash animations or blinking giffery nonsense … my other pet peeve.

Just read a piece that Safari 3 is allowing another method of invoking website clutter and annoyance via simple commands in CSS, without any method that I’ve run across to turn them off.

23 01 2009
jane73

Hi Ohm51
Thank you for your comments on the blog.
I’m sorry that the suggestions for Copying File-path didn’t work on your machine running Tiger. If you click on the link to the FileUtilsCM website they list previous versions of the utility that are available for download for 10.3.9 or later and 10.4 or later. Hope this helps.
Look forward to seeing you back on the site again soon :-)
Jane.

26 01 2009
NosillaCast @ podfeet.com

[...] Winclone from twocanoes.com/winclone and Jane explains how to copy a file path, read about it at galacticstrings.com. Our cable goes out as soon as Lost starts so I use ted from ted.nu to find it online and download [...]

2 02 2009
David

Neat.

13 02 2009
Kevin

@Ohm51 – Make your document format Plain text (under the Format menu.) And remember you can drop a file into text fields in Safari and get the path that way.

This is a 1 line AppleScript that will do this…

tell application “Finder” to set the clipboard to POSIX path of (selection as text)

Can be run from the AppleScript menuextra or if saved as an application can be run from the toolbar of Finder windows. And if put into an Automator action can be saved as a Finder plug-in that can be run from the Finder’s contextual menu.

27 11 2009
MBAP

Dear Jane;

Thanks for posting this tip. It was just what I needed to accomplish what I wanted.

Best wishes from
MBAP
On an island somewhere in the Pacific

Disclaimer: I am not now nor have I ever been a mathematician, computer programmer or full-time Mac user. Your mileage may vary. Void where prohibited by law. Does not scare either horses or children.

Leave a comment