What's a quick way of copying the path to the directory that's currently open in Finder?
Copying that path is very easy in Linux and Windows file managers - you just need to copy it from the address bar. I don't see a corresponding option in Finder.
|
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. There are some third-party apps, some free, some paid, that add this functionality. You can also create a service with Automator (or AppleScript) to do it, but a simple and free method that I like, especially if you like to use the terminal anyway, is to invoke DTerm on the Finder window and run:
That will copy the current path to the Mac OS X clipboard. |
|||||||||
|
|
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.
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
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.
|
||||
|
|
|
Command + I, then copy information under Where:
|
|||||||||||
|
|
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. |
|||
|
|
|
If you use Alfred, you can select the items, press ⌥⌘\, and select Copy path to Clipboard. You could also assign a shortcut to a script like this:
This would copy the paths of all selected items:
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:
|
|||||
|
|
If you need the path in Terminal/iTerm, you can just select the file/folder in Finder, copy it (Command-C), switch to the Terminal and paste it (Command-V). You can also make a drag'n'drop the file/folder to the Terminal/iTerm. |
|||
|
|
|
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:
Use the following to turn it off again:
|
|||||||
|
|
Back a few years ago, I would always have the pos utility written by Gary Kerbaugh to improve finder / terminal interaction.
This coupled with I believe homebrew has adopted part but not all of this package so I'm not sure if you can find a workable version of all the above, but it was magic when I first started using it. Now I just use Launchbar to push files around without caring so much about recording a specific folder. |
|||||
|
|
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.
What is not (easily) possible:
|
|||||||
|
|
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.
|
||||
|
|
|
To copy the active path in Finder, simply control-click the folder or file to bring up the contextual menu. Next, select |
||||
/Volumes/whatever/path/to/frontmost/window/viewor 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