Note: If this tutorial worked for you (and it should work), please leave a comment below. Thanks.
If you would like to instead just get the file path of the selected document, you can use the Finder's "Show Path Bar" option in the View menu, open the document in a program and use the path menu, or by searching for the item in Spotlight followed by holding the Option and Command keys while hovering your mouse over a search result to reveal its path in the preview window. However, these approaches do not give you the option to copy the file path as text.
You can select the path to the file's parent folder in an info window and copy it.
To copy the file path of a file or folder as a text string that you can paste into another document, there are several approaches you can take:
Info windows
- The first option is to use the information window for the item, which will show you the full path to it up to its parent folder. Select the item and press Command-I to open the information window for it, and then locate the path in the General section next to the keyword "Where."
- While generally intended to be a quick view of file information, the text content in the information window can be selected by clicking and dragging or by double- and triple-clicking, so you can use these approaches to select the file path and copy it from this window.
- Drag a file or folder to the Terminal window to instantly reveal its path.
Terminal
- The OS X Terminal is one program that can handle file paths via drag-and-drop as text, instead of trying to manage their contents. Being a text-based tool itself, Terminal will quickly output the specified file path as text, which can be selected and copied.
- To do this, simply launch Terminal and then drag a file to its window, and Terminal will output its file path at the command prompt, which you can then copy. You do not need to know any Terminal commands to do this, and can close the Terminal window when you are done copying.
- Drag a file to this text field to reveal and then copy its full path (be sure to first delete any existing text).
The Go to Folder feature
- The Finder has its Go to Folder feature, which can be used for accessing hidden directories, but similar to the Terminal, you can drag a file or folder here to reveal its full path.
- To do this, open a new Finder window by pressing Command-N, and then press Shift-Command-G to reveal the Go to Folder panel for the new window. Then drag a target file from another window to the Go to Folder text field, where it will be converted to a full text path that you can select and copy. Unfortunately you cannot drag a file from the same window once the Go to Folder panel is open, but you can drag from the desktop or another Finder window.
- Create this simple workflow in Automator to have a service that will copy the paths of selected files as text.
Create a path-copying service
- If you regularly need to copy a file path as text, an easier option would be to create a service in utomator that will do this for you. First launch Automator and create a new service workflow. Then make sure the inputs for it are "Files or Folders" in the Finder (done with the menus at the top of the workflow). Then drag the "Copy to Clipboard" action to the workflow area and save the service with a name like "Copy Path as Text."
0 comments:
Post a Comment