35

How can I copy the path to a folder or a file? The Info Dialog doesn't allow me to copy the information that stands there ...

alt text

Is there an easy way to do this?

4

11 Answers 11

48

Right click on the file, hold down Alt/Option, and an item to copy file path will appear as Copy "<FILENAME>" as Pathname.

This is the easiest option for day to day usage, without involving Automator.

This seems to be a relatively new feature that was added in OS X El Capitan. (It also works on macOS Sierra).

5
  • 1
    an even easier option is to click the Finder Edit menu, press the Option key and then Copy xyz will turn into Copy xyz as pathname — easier than right-clicking which requires an extra finger.
    – ccpizza
    Commented Aug 29, 2020 at 11:59
  • Interesting, cool to know! I guess it's easier if you use control+click. I always use a two finger tap on the trackpad or a physical right click on a mouse.
    – Oion Akif
    Commented Aug 29, 2020 at 18:44
  • Note: Doing alt+right-click (holding the alt key while you right-click) doesn't work; you need to right-click, and then hold the alt key. Commented Oct 19, 2021 at 18:06
  • 2
    or just opt+cmd+C pure keyboard shortcut
    – wisbucky
    Commented Oct 8, 2022 at 12:40
  • @JonSchneider for me, it doesn't matter when you press the Alt key—as long as you are eventually pressing it while the right-click menu shows up, the option will appear
    – Oion Akif
    Commented Oct 12, 2022 at 5:53
14

Starting in El Capitan (OS X v10.11), this is really easy:

  1. Select the item(s) in the Finder
  2. Press Command-Option-C (or hold the Option key down and choose Edit menu > Copy [whatever] as Pathname.
3
  • 4
    There really needs to be a way to pin this to the top as "Best Answer Which Was Not Available At Time When Question Was Asked."
    – TJ Luoma
    Commented Oct 9, 2018 at 0:18
  • 2
    Oh yes, this is it. All the answers were about copying path by selecting folder first, but I wanted path from inside of the folder. I've opened a folder, I'm here I want a path. Command-Option-C solves the problem. Added to touchbar ;d Commented Sep 19, 2019 at 23:54
  • 1
    Yeah, good point by @KamilDziedzic. Copies what is selected - or - if nothing is selected, copies the current folder.
    – netigger
    Commented Jun 26 at 6:04
11

As already described by ayaz, the Get Info window (cmd+i) has the full path and will allow you to copy it. If you tripple click in the highlighted area (by the red rectangle) the selection will automatically expand to the whole path. cmd + c will suffice to copy it to the clipboard.

get info window

If you need the path to interact with the Terminal, you can always check one of the “zillion” answers in this Stack Overflow Question.

UPDATE: This method seems to be only valid for OS X 10.6.x, previous OS X versions used the non-POSIX path style that looked like path:to:file, whereas the POSIX would be path/to/file. If you are in something older than OS X 10.6, you will have to try one of the other methods described in the other answers (or upgrade to 10.6 ;)

4
  • I don't know why but this doesn't work for me. There is no selection at all in this dialog.
    – Rabskatran
    Commented Sep 29, 2010 at 15:33
  • What OS version do you have? Commented Sep 29, 2010 at 19:15
  • This doesn't work for me either, running 10.5.8
    – KeithB
    Commented Sep 29, 2010 at 20:35
  • The info method not working might be a 10.5 vs. 10.6 issue. I just noticed for the first time that the path displayed is POSIX style and not the long-standing "path:to:file" style. Commented Sep 29, 2010 at 20:42
9

There are two ways I do this (and the info window is neither of them):

  1. Open the Terminal application and drag the item into the window, and a POSIX-style path will be displayed that you can copy and paste.
  2. Use Applescript...

...select an item in the Finder and run this...

tell application "Finder"
    return info for selection as alias
end tell

...or create a droplet with this code...

on open theFile
   set thePath to POSIX path of theFile
   set the clipboard to thePath as text
end open

Add salt to taste.

1
5

The best and easiest way to do this is by creating a "copy path" service, very similar to the shift + Right-Click on a Windows machine.

If you frequently need 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.

Follow these steps to set it up (screenshots below).

  1. Launch Automator
  2. Create a new “Service”
  3. Use the search function to look for “Copy to Clipboard” and drag that into the rightsize panel of the Service Set ‘Service receives selected’ to “files or folders” and ‘in’ to “Finder”.
  4. Save the Service with a name like “Copy Path”.

    enter image description here

The result:

enter image description here

You'll now have the textual path in your clipboard.

Sources: CNet, OSX Daily

3
  • This should be the correct answer. Shame that Apple did not enable such a simple conf as the default ... It took MSFT 5 years to implement the copy as path right menu item after countless regedit and dll hacks were invented by the community ... such a good example of the fact that big companies do not really study carefully the needs of their customers ... Commented Nov 25, 2017 at 22:14
  • In Mojave, Service is now called Quick action (a great innovation, goes without saying.) Commented Dec 15, 2018 at 13:57
  • I upvoted this despite that step 3 is a nightmare of a sentence that is impossible to understand. I hope you can edit this step so I (and other possible users) can get this working. Commented Jan 15, 2022 at 23:54
3

Simply drag the file into text editor, and it will give you the full path for that file.

3

Method 1: In macOS holding the ALT key(⌥) often shows extra options in context menus. Copy "item" as Pathname. Detail https://apple.stackexchange.com/a/318007/302207 detail


Method 2: If you use TotalFinder, you can Allow path copying from Context Menus

TotalFinder makes it really easy to capture a variety of path formats for a selected object. Right-click on any file or folder, select Copy Path, and select the path format you'd like copied to the clipboard.

images_context-menu-path

TotalFinder setting path:

enter image description here

1

This is how to create a Service to copy to the clipboard the selected paths in Finder:

  1. Open Automator. Press ⌘+N and choose Service.
  2. Set "Service receives selected files or folders in Finder.app".
  3. Drag the element "Run Shell Script" to the window.
    Note: You can select this element if you go to the left of the window and click on Actions, Library, and type part of the name in the search box.
  4. Set "Shell: /bin/bash", "Pass input: as arguments" and type the following in the script box: for f in "$@" do echo "$f" done.
  5. Drag the element Copy to Clipboard.
  6. Save your service in ~/Library/Services/Copy POSIX Paths.workflow (or any other name you like).

Now you will be able to run this service if you right click an element and choose Services > Copy POSIX Paths. It will copy the file(s) selected in Finder to your clipboard. I tested this on Lion.

Automator

I got this tip from Kris Johnson's Blog.

0

I will move my comment over as an answer.

You should be able to copy the path to a folder/file by highlighting the value next to "Where:" in the info dialog and pressing CMD+c.

An easier alternative that requires less effort is right-clicking on that value, and clicking "Copy" in the drop-down that appears.

1
  • Doesn't work for me...
    – Rabskatran
    Commented Sep 29, 2010 at 12:26
0
  1. Start automator
  2. Create a new service
  3. Set the service to acquire files and folder in the finder, and add the run applescript element
  4. Paste this script

    on run {input, parameters}
    set mylist to {}
    repeat with elem in input
        try
            set the end of mylist to (POSIX path of (elem as alias))
        end try
    end repeat
    set oldtid to AppleScript's text item delimiters
    
    
    set AppleScript's text item delimiters to {return}
    set flatlist to mylist as text
    
    
    set AppleScript's text item delimiters to oldtid
    
    
    tell application "Finder" to set the clipboard to flatlist
    
    
    -- code below will also create an email with the path inside. delete it if you don't want that.
    tell application "Microsoft Entourage"
        set theMessage to make new outgoing message with properties {subject:myFileName, content:flatlist}
        open theMessage
        activate
    end tell
    end run
    
  5. Save the result as 'copy and email path' or something.
  6. Now check your ctrl-click menu and your services menu. Nice!
0

Sometimes the solution is so simple.

Just mark the file in the finder and then press Command-C. The path including the file name is copied to the clipboard and you can paste it in any application.

4
  • I just got the filename in the clipboard. How Do You get the full path ?
    – Rabskatran
    Commented Oct 5, 2010 at 11:47
  • 2
    In the finder, click once on the filename or the icon so that the file is highlighted (if you can change the filename now, you clicked to often and you must press Escape to cancel the rename operation). Then press Command-C. Commented Oct 5, 2010 at 19:29
  • doesn't work for me either, just the filename is copied. Commented Oct 6, 2010 at 18:28
  • I just checked it. It works when pasting into Terminal but not into TextEdit. Dragging and dropping a file into Terminal pastes the filename and path. Dito in TextEdit. What about other applications? Commented Oct 7, 2010 at 4:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .