Tricks to get the full path and filename of a file in Finder

Since I do a lot of work in Terminal and find it quicker to process files on the command line for some things so I need to get the path to a file for passing as an argument to Unix commands. It's not obvious at all how to do this from Finder. You can have Finder show the path but there's no way to copy it! Right-clicking only shows the parent directories in order to quickly navigate but not to copy (unlike Windows Explorer where you can access the path like a browser URL).

If you right click a file and select 'Get Info' you will see in the 'Where' section the parent folders are shown, but still the format is not a path and can't be used anywhere requiring a full path. So there's no intuitive way to see or copy the path in Finder.

But wait! There are at least 2 unintuitive ways to get it!

  1. Right click on your file to get the context menu. Now hold down the alt/option key. Some menu items should change. What you'll notice is the "Copy " menu becomes "Copy as Pathname". If you select that, your clipboard/paste buffer now contains the pathname of the file.

  2. The second way is to open Terminal next to Finder. Now drag and drop the file onto the Terminal window. It should copy the full pathname to the command line, or directly into whatever program you're running in bash.

Add new comment