Mac Finder: Getting the path of a directory or file as as string
Ctrl-click (or two finger click) on the file you want the path from, then press Opt and select "Copy as path name" (or what it's called in english) from the context menu.
You can also just select the file and then press Opt-Cmd-C to copy the pathname to the clipboard.
I don't see a way to do it with just Finder. The best I could do is:
- Open a Terminal window.
- Drag the file you want into terminal.
- Select the filename in the terminal window.
- Copy the filename to the clipboard.
Safari will also work. It's a file URL, so you will have to be careful with your selection.
You can drag the file or folder from Finder application to the dialog box. The full path of the file or folder will appear in the dialog box. Additionally, you can drag a file or folder into the Terminal application or many other apps, to expand the path.
Also, if you enable showing the Path Bar in the Finder application, then you can drag any part of the full path to a dialog box. The Path Bar can be enabled by selecting View➔Show Path Bar
from the menu bar or by using the option+⌘+P key combination.
I'm using macOS Mojave. It's easy to find what you want, just go to folder and click on gear icon on top of window, there you can see option called "Copy 'folderName' as Pathname" That is it!