@AdamEberbach I disagree, the question you linked is about starting a Terminal instance at the current Finder path, this is about simply getting the path
–
Kyle CroninApr 2 '12 at 4:05

2

Can you explain what you mean by copying the path? Do you want it to the clipboard in expanded form /Volumes/whatever/path/to/frontmost/window/view or something else? Basically, what is the next step you are going to perform with the path once you have it?
–
bmike♦Apr 2 '12 at 4:09

1

@Adam: Not exactly. I'm looking for a quick method - similar to the ones I'm used to on Windows and Linux (i.e. either pressing a couple of keys or clicking and pressing a key or two).
–
HippoApr 2 '12 at 4:22

1

@TimothyMueller-Harder: Though that question is similar, there is a difference between getting the path for a file or folder in the Finder and getting the path for the active window, especially if something is already selected in that window.
–
joelsephApr 2 '12 at 22:22

14 Answers
14

Next to the name of the folder in the Finder is an icon depicting that folder. This icon can be dragged to anywhere you need to accept a path - dragging to the Terminal or TextEdit in plain text mode will drop the path as text in the window or document. However, this does not work with all destinations - copying to a rich-text TextEdit document, for example, copies a link to the folder and not the path.

Ooh - great use of DTerm. I never spent enough time to learn it's true power, but more people I know swear by it than at it.
–
bmike♦Apr 2 '12 at 4:26

@bmike Yeah, I don't use it much, but it was my first thought when I read this question (after discovering that Finder indeed does not have this functionality built-in by default). It has the advantage that DTerm is a general-purpose tool and not something that needs to be installed or set up for this specific purpose.
–
Kyle CroninApr 2 '12 at 4:36

2

This is exactly what I use DTerm for most of the time!
–
jtbandesApr 2 '12 at 5:34

You can use Automator to do this with a single keyboard shortcut that you can use from any app, and without installing 3rd party software.

This Automator Service will copy the path of the Finder's front window, rather than the path of a selected file or folder, so it won't affect what windows are open or what items are selected. The path that is copied is simply text, so it can be pasted anywhere that you can paste text.

Open Automator and create a new Service.

Change "Service receives selected" to no input (or "files or folders" to have it appear from a right click) and leave it set to any application (unless you only want it to work from a specific app, like the Finder).

Add a "Run AppleScript" action to the workflow.

Replace (* Your script goes here *) with:

try
tell application "Finder" to set the clipboard to POSIX path of (target of window 1 as alias)
on error
beep
end try

Save the Automator Service with whatever name you'd like it to have in the Services menu.

This Automator Service will now be in your Services menu.

Note: This doesn't escape spaces, so if your path has spaces, you may need to quote it. For example, in Terminal, the path would need to be quoted, but in Finder's "Go to Folder" command, it would not. If you want it to copy as quoted, you can change POSIX path to quoted form of POSIX path.

You can add a keyboard shortcut for the service by going to System Preferences > Keyboard > Keyboard Shortcuts, then click on "Services" in the left pane, then scroll down to the "General" section in the right pane until you find your service.

tell application "Finder"
set the clipboard to POSIX path of (insertion location as alias)
end

This would copy the paths of all selected items:

set l to {}
tell application "Finder" to repeat with f in (get selection)
set end of l to POSIX path of (f as alias)
end repeat
set text item delimiters to linefeed
set the clipboard to (l as text)

There's a bug on 10.7 and 10.8 where the selection, insertion location, and target properties refer to the second frontmost window after opening a new window. It affects both scripts and Alfred, but not Automator services. As a workaround, you could move focus to another application and back before getting the selection:

Good stuff; note that the bug also affects Alfred. If only selected items are needed (2nd script), you can avoid the bug by modifying the script to operate on input and by assigning it to an Automator-based Service that receives files or folders in Finder.app. To work around the bug when obtaining Finder's insertion location (1st script), you can apply the following, uuugly, but effective hack (works on 10.8.2): hide Finder, then unhide it again after a short delay - this will cause Finder to report the correct selection/insertion location afterward; obvious downside: flashing.
–
mklement0Oct 29 '12 at 13:05

Although this doesn't answer your question directly, I have a more efficient method of obtaining the file's path (presumably for it to be pasted into terminal or a text file, for example). Simply drag-and-dropping the file into a text field will automatically insert the file's path.

The MacYourself tip Copy file or folder path to the clipboard in Mac OS X Lion works for me on 10.7.4. Basically it leads you through the steps of creating an Automator service that can be used to copy the full path of files and folders from the Finder. You then use it by assigning a custom hotkey or use the right-click menu to copy the path to the clipboard when a file or folder is selected.

If it helps, you can also type the following command into the Terminal to get the Finder to display the full path to the current folder in its titlebar:

Since you already have the AppleScript made (assuming that screen shot is yours), can you please upload it to a service like droplr.com and offer a direct download link please? It'll be more user friendly for the OP. Considering he's new to the Mac OS, i'm assuming he won't like fiddling around with applescripts/automator services
–
XAleXOwnZXAug 28 '12 at 6:32

@XAleXOwnZX Seeing as the file lives in ~/Library/Services I think describing a method to download the file then copy it here (as ~/Library is hidden by default on Lion), then follow half the MacYourself instructions to add the shortcut would actually be more complicated. The instructions provided by MacYourself are pretty straightforward to follow.
–
binarybobAug 28 '12 at 6:41

works i guess. Lol for these types of questions, i'd usually use package maker to create an installer that takes care of everything as needed, but i'm on vacation =/
–
XAleXOwnZXAug 28 '12 at 6:42

The easiest way I know to get the path to a file or folder is to Get Info on the folder or file (select it, right-click and pick Get Info), and then in the middle "General" section, you can select and copy (command + C) the path.

As for your other question, clicking on column headers in list view in the Finder does allow you to sort ascending or descending.

I do not understand the last question you ask -- again, I'd say go to the file itself, right-click and do as I described above to get the path.

On OS X, many things can be accomplished by dragging & dropping. Apple thinks you don't need to be able to access the file path conveniently because everything can be accomplished by drag & drop. I'm not completely of the same mind, but usually I can do what I want.

This is how common actions are performed on OS X where you would need a path in Windows or Linux.

To just find out where you are in Finder, right-click (or Command ⌘-click) the folder name in the title area.

In a file selection dialog, to navigate to an opened Finder location, drag the folder or any file from that folder onto the selection dialog. This will not move the file or folder like it does in Windows, but set the path of the File dialog instead. (You can also drag a the document proxy icon (from the title bar of most apps) or ⌘-drag items out of the Dock to do this.)

To get the path of a file in Terminal or another text-only Application, drag the file on the Terminal window.

What is not (easily) possible:

Inserting the file path of a file that is supported differently in an Application. For example, dragging an image into TextEdit (in RichText mode) will insert the image itself instead of the file path.

Potential confusion: Although command-click is the correct action for what you're describing, the term 'right click' in OS X conventionally refers to 'control-click'.
–
applehelpwriterJan 22 '13 at 11:55

@applehelpwriter It works with both Right-Click (which is [Ctrl]+Click) and [Cmd ⌘]+Click, so the sentence is absolutely correct, even though it was edited in by someone else
–
dualedJan 22 '13 at 14:39

Agreed, but I didn't read it that way. The expression "right-click (or Command click)" doesn't parse as two different options, which should be 'do A or B'. Rather, it looks like one option which is given an alternative name in parentheses. That's why I prefaced my comment with 'potential confusion'.
–
applehelpwriterJan 23 '13 at 10:34

To copy the active path in Finder, simply control-click the folder or file to bring up the contextual menu. Next, select copy the_folder/file_you_want. Following that, you can paste the path to a terminal window.

I just made a quick Automator Action.
The Get first Finder Window Path action will to get the front most Finder windows Posix Path.
It a beta, but is working ok. 10.8 only
It will return the Posix path of the front most open Finder window.

1, Open the zip and install it by double clicking on the action.

It will go into the Utilities Actions name 'Get first Finder Window Path'

2, drag it as normal to workflow area and add for example the 'Copy to Clipboard' action below it

The Service selected can be file or folder if you save it as a'Service' this will enable you to then also use the contextual menu when clicking on any file or folder. doing so will run the actions and only return the Same window result. Not the selected file or folder. Alternatively set it to 'none.

You can save it as a service or like me save it as an Application and then drag the app into the finder windows Toolbar.
Where you just have to click it.