Quickly Copy a File or Folder Path to the Clipboard in Mac OS X

Jun 19, 2013 - 19 Comments

There are a few ways to retrieve a file or folders full path from Mac OS X, and we’ll cover the two easiest methods here, and also a third option that utilizes a Service to instantly copy any path to the clipboard. First, we’ll use the Get Info panel to pull any items complete path, and then we’ll use another trick that utilizes an under appreciated feature of the Terminal to retrieve any directory or files path. The optional Automator Service provides yet another option to copy file and folder paths, which is then quickly accessible through the right-click menu from the OS X Finder.

File or folder path in Mac OS X

Just to clarify, we are looking to copy the path to a file or folder to the clipboard so that it can be pasted elsewhere. This is different from showing the path, which can be made visible in any Finder window through an optional window bar or even in the title bar using a defaults trick.

Let’s get to copying complete paths so that you can use them elsewhere.

Copy a File / Directory Path from the OS X Get Info Window

Perhaps the easiest and most user friendly method, you can easily retrieve any file or folders path from the Get Info window by doing the following:

  • Select the file or folder in the OS X Finder, then hit Command+i to summon Get Info
  • Click and drag alongside “Where” to select the path, then hit Command+C to copy the full path to the clipboard

Copy a path of a file or folder on the Mac through Get Info

Get Info can also be accessed by the control-click and right-click menus. For most use cases and for occasional complete path access, the Get Info trick is simple, fast, efficient, and should fit the bill for most people.

Print Path through the Mac Terminal

Dragging and dropping anything into the OS X Terminal outputs the full path to that item.

  • Launch Terminal then drag and drop any item from the Finder into the Terminal window to instantly print the full path
  • Select and highlight the path to copy it to the clipboard as usual

Print and copy a files path in the Mac Terminal

This trick is great if you are looking to use the path in the Terminal, otherwise it may not be as easy as the Get Info tip because it requires opening another app.

Create a “Copy Path” Service for the Right-Click Menu

If you find yourself frequently needing to copy and paste file and folder paths, creating an Automator Service will make your life easier because the service then becomes accessible from the OS X Right-Click contextual menu, accessible from anywhere in the Finder. This is an excellent trick from CNet and is very easy to set up yourself:

  • Launch Automator and create a new “Service”
  • Use the search function to look for “Copy to Clipboard” and drag that into the rightside panel of the Service
  • Set ‘Service recieves selected’ to “files or folders” and ‘in’ to “Finder” as shown in the screen shot below
  • Save the Service with a name like “Copy Path”

Create a "Copy Path" Service in Mac OS X

Now go anywhere in the Finder, select anything in the filesystem be it a directory or a file, then right-click to reveal the “Copy Path” service item as created.

Copy a File or Folder Path through a Service in Mac OS X

Choosing that option will instantly copy the chosen items path to the clipboard, which you can then paste elsewhere.

What is a path anyway?

For the unfamiliar, you can think of an items path as it’s address in the file system, pointing to exactly where it resides on the computer. For example, a file named “Testfile.txt” that resides on your user account desktop would have a complete path that would resemble something like this:

/Users/USERNAME/Desktop/Testfile.txt

For items in the user directories, you can user a tilde to shorthand the path like so:

~/Desktop/Testfile.txt

That shorthand does not work with system files, or for accessing other user files, thus a complete path would be needed. All of the methods we’re sharing will access and copy the complete path, not the short hand, even if the file or directory in question is in the user folders.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Mac OS X, Tips & Tricks

19 Comments

» Comments RSS Feed

  1. bob says:

    “Save the Service with a name like ‘Copy Path'”

    Where is the save button? How is this done?

  2. Bloodklot says:

    Is there a way to make that automation a widget on the top of the finder window so all we have to do is click the button instead of right clicking on the file?

  3. johnres says:

    Well, you can use Long Path Tool as well, it works for such problems..

  4. getri says:

    Even easier: Go to the keyboard preference, check the box next to “copy path”, click on the right to add your shortcut… Voila!

  5. cory says:

    LOVE the automator options for this. thanks so much!

  6. Chris says:

    Automator way is exactly what I needed! Thanks! and to answer Bob, it’s in right menu under “services” for me.

    • Jeff says:

      I see mine under “Services” as well. I’m on Mavericks 10.9.2. Is there anyway way to move it up a level? So “Copy Path” is right there in the rightclick context menu instead of nested under Services?

      • Jeff says:

        Actually, I solved this myself! If you have more than 5 services, it will nest under the Services subfolder. Go to your system preferences – Keyboard – Keyboard Shortcuts. Click Services on the left, then unchceck anything you don’t use from that Services menu. If you get it under 5 items, they will appear without the context menu.

  7. Hedo says:

    Works perfectly, thanks a lot !
    Thanks also to Jeff for the “Service>…” tip, solve it as described

  8. Jason says:

    If you have Office for Mac (2011), all you have to do is copy (command C) a file in finder and you can paste a clickable link into Microsoft software. Why it’s MS software only, I don’t get but it works beautifully.

  9. Gojira says:

    I foloowed the instructions of “Create a “Copy Path” Service for the Right-Click Menu” and it works. Thank you, thank you, thank you!!!

  10. Ian says:

    A useful tip to create the automator and the process was simple. However when I paste the link into an email it does not work at all:

    Link is: /Volumes/Scans-4/SCANNED/Documentname.pdf

    Cant work out why! Very frustrating

  11. Ronald says:

    It nearly works as expected, but after copying, the file path ends up in the clipboard with colons as path separator, instead of slashes. AFIK, colon path separator had been in use in the old Mac operating systems, before they “went BSD”.

  12. Guy says:

    Brilliant! Worked right away. Pity Apple doesn’t make the interface for Automator more informative; it must be useful for making all sorts of procedures more efficient.

  13. Etienne says:

    In my case, I added a keyboard shortcut, it works for files but not folders, I can only copy folder if I right click them.

  14. Etienne says:

    Any ideas why ? Just let me know if any of you guys come across this.

  15. Faizan Noor says:

    Awesome guide to enable Copy Path service. Thank you Sir. Highly appreciated!

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates