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

Jun 19, 2013 - 63 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.

.

Related articles:

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

63 Comments

» Comments RSS Feed

  1. Bryan says:

    An Easy way to copy full path to a server including IP, you could use :

    control + option + command + C

    Example:
    afp://192.168.55.24/Production/JOBS%2021/client/job

  2. William says:

    So.. Have used the copy service for a long time, but want to add something.. hoping someone has a solution here.

    I copypath this:
    /Volumes/Rte/GFX/Assets/3DModels/B/Bass_Drum.zip

    and I want to send it to a colleague on a pc as this:
    \\10.1.4.9\rte\GFX\Assets\3DModels\B\Bass_Drum.zip

    So.. I think I need an AppleScript that will strip out the “/Volumes/Rte/” and replace it with “\\10.1.4.9\rte\”
    and then change all the “/” to “\”

    Suggestions?

  3. Jeremy says:

    Per the section above “What is a path anyway?”

    Is there a quick way to “copy as pathname” to remove the user account and instead capture the tilda (~), without manually removing and typing?

    ~/Desktop/Testfile.txt

    instead of

    /user/username/Desktop/Testfile.txt

    I’m currently working with a large team of people who have had to migrate our main servers to MS Sharepoint/OneDrive and sharing files is not intuitive. Using the MS links takes you to a web browser instead of a Finder path. When copy as pathname is used, the username is captured. When shared with others, the end user has to recognize this otherwise it will not work on their user account.

    I understand this is not a very complicated thing to fix but hoping to find a better solution so less savvy people can quickly copy and paste paths to share with others without having to manually edit pathnames.

  4. RoBro says:

    Brillllllliant!! Thank you to the author and CNET

  5. Gokul says:

    2018 and still works! thanks a lot!

  6. Mike Sevik says:

    Thank you so much… 8/19/2018 still works…
    You made my life a little easier!

  7. Maxwell says:

    OSX 10.11+ users can use:
    Option (⌥) – Command (⌘) – C

  8. Colette says:

    Thank you! That was a great post, easy to follow, and is making my life a WHOLE lot easier. :)

  9. Christopher says:

    At least in the latest versions of macOS you can easily copy a files path my right clicking on it and then hold down Alt/Option and then choose Copy “…” as Pathname instead of the usual Copy.

  10. Linda says:

    The easiest way is to drag and drop the file onto a new TextEdit file….the file path is then shown.

  11. ikomrad says:

    The copy path service almost works as advertised, but I have to go down to the “Services” menu option and select “copy path ” from there. Is there a way to place it on the top level context menu the way it is in the screenshot?

  12. Christopher Rodriguez says:

    Even easier (on Sierra, at least):

    1. Secondary click/right click on a file or folder
    2. Hold alt/option key while the context menu is available – this will change the “Copy {X}” option in the context menu to “Copy {X} as path”
    3. Paste that path to your heart’s content.

  13. Dude. Thank you. Somehow I never made the deduction that “copy to clipboard” in Automator might actually copy the path itself. It’s exactly what I wanted (woohoo!) but definitely not what you would expect.

  14. Erin Koss says:

    Thank you for the Copy Path tip! So helpful. I had never used Mac Services before and my world was just expanded.

  15. Mario says:

    This is fine for local files, but it’s really not that useful unless you’re producing a “How To” guide or something. I’m trying to figure out how to copy the “Server” file path for a document on a network share. That’s a far more useful implementation in an office environment.

    • Diego_G says:

      Hi,
      Where you able to solve this riddle? I need to be able to copy the server path and not the local besides using the info panel.
      Thank you

  16. Chaim Kram says:

    Super-useful tips. Thank you!

    I discovered btw that in my Get Info dialog box, the path appears in the old Mac style ( Macintosh HD ▸ Users ▸ …. ) but if you select any portion of it and paste it into a text area of any kind, you get the Unix path. Very handy.

  17. Jay says:

    Just use Copy works as well. (cmc-c, while the files are selected in the finder)

  18. MIke says:

    Command-option-c will copy the path name without creating a service.

  19. John Xiao says:

    Finally I found Mac’s ‘copy xx’ menu item with shortcut of `cmd+c` of finder is already have the feature of copy path: just try paste directly in terminal.

  20. hachepunto says:

    I do not know from which version is, but if you press cmd + alt + c in a file or a folder, copy the document path to the clipboard without anything else.

  21. Barry Drake says:

    Awesome! Thanks.

  22. Has anyone come up with a workaround for this? Ive just bought a Macbook pro, my previous laptop was windows PC which allowed me to copy and paste links to folders into evernote. I need to do this with Finder / dropbox folders.

    Thanks,
    Rob

  23. Matthew Beaty says:

    Sadly, Mac has updated the path that’s listed in the info on a file or folder.

    It now includes useless arrows, instead of the actual path. Annoying regression I believe they call an ‘improvement’.

  24. David says:

    In order for it to be a “link” that when clicked on it will jump to that file, it needs the following: file:///volume/smith/ . . . etc. How can we get that “file://” to start the path name? Also, if there is a space in the file name, then we need the %20 in between the words. How does that get added?
    Thanks, David

    • PReinie says:

      David (comment from 20141216) you might try making another automator workflow that pastes the file:///volume/smith text and then calls the copy file folder path workflow or just calls something that pastes whatever is on the clipboard (wherever you used this workflow to copy there). I haven’t tried it.

      As far as adding the space characters instead of %20s, wherever you want to paste put down two “” and arrow once left so you’re between the double-quotes and then paste the copied path. “/Users/Shared/Library/Services/Copy File Name&Path to Clipboard.workflow” Hey, that worked. I’m not sure how well the ampersand between Name and Path will make it to this posting.

      Windoze, at least in W7 and maybe XP (I just don’t recall) has shift-right-click a file and Copy as Path is right there and automatically puts the double quotes around the full path. No coding needed.

    • Matt Holland says:

      It just requires adding one additional step to the Automator workflow described above. Make the first item in the workflow be “Run Applescript”, and in the box where you edit the Applescript to run, put:

      on run {filepath}

      set PosixPath to POSIX path of filepath as text
      set theOutput to “file://” & PosixPath

      return theOutput
      end run

      Then connect the output of that section to the same “Copy to Clipboard” action you were using before, and you’re done.

      • Michelle C. says:

        Hey Matt – When you say “connect the output of that section to the same “copy to clipboard” action you were using before…how exactly do I do that?

        Thanks!

        • Michelle C. says:

          Nevermind! I got it. Couldn’t copy and paste and to type everything out.

          I do still get the issue of the path having spacing in it verses the %20s.

      • MarkusS says:

        Thank you for telling us how to add the “file://” before the file path! It still works in OS X 10.11.6 ElCapitan.

  25. cud says:

    Huzzah! The Mac has finally become more cumbersome and flaky than Windows! Looking at the title to this post (QUICKLY copying a file path), I throw back my head and laugh.

    My work has forced me to take up a Mac again. One should greet this with pleasure. It has been nothing but a royal pain. This is a prime example… Why are paths obfuscated?

    • Jimbo says:

      It’s in GET INFO, for OS X 10.9 – 10.10

      [ ⌘command+i ] or right-clic and select [ Get Info ]

      In the [ General ] box it displays the path in an easier way to read, with [ ▸ ] arrows between directories.

      In the [ More Info: ] box just underneath clic the [ ▸ ] and the box will expand showing the full real path.

      Select/Copy/Use!

      Jimbo

  26. Neha says:

    Thanks a lot for providing a Service Context Menu option because Copying Path from Get Info do not work anymore for Mac OS X 10.10 Yosemite.

  27. Wesam Alalem says:

    I always used the Get Info window to get folder/file path. After MAC OS X 10.10 the path components separated by arrows and no longer possible to copy the full path, also it was showing only the parent path.
    I like the Service option easy to access and copies the full path.
    Thank you.

  28. Faizan Noor says:

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

  29. Etienne says:

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

  30. 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.

  31. 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.

  32. 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”.

  33. 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

  34. 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!!!

  35. 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.

  36. Hedo says:

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

  37. 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.

  38. cory says:

    LOVE the automator options for this. thanks so much!

  39. 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!

    • ikomrad says:

      I don’t see copy path anywhere in keyboard preferences, can you be more specific as to where it is? under keyboard I have keyboard, text, shortcuts, and other tabs. I searched all of them for copy path and did not see it. thanks!

      • soso says:

        You create the Automator Service, save it, then you can find it in the system preferences under Keyboard>Schortcuts>Services and give it a keyboard shortcut.

  40. johnres says:

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

  41. 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?

  42. bob says:

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

    Where is the save button? How is this done?

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

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

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site