Very handy if you are frequently trying to get fully qualified filenames to be pasted into Terminal.
Considerably better than
>Highlight the file in Finder
>Press Get Info
>Copy the filename in popup window
The service will be saved in Library>Services
Can be accessed in Right-click contextual menu in Finder.
Detailed instructions after the jump below.
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 Automator 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.\”While it seems like a replacement for pressing Command-C in the Finder, this approach will ensure that the file paths are copied in full as text instead of only as references that will either be truncated to file names, or be otherwise altered.With this service created, you can now select any number of items in the Finder, right-click them, and then choose \”Copy Path as Text\” from the Services contextual menu and be able to paste the path or paths in the location of your choice. You can also use the keyboard system preferences to assign a custom hot key such as Option-Command-C to the service, so you can invoke it directly.Keep in mind that this approach will not copy a file reference, so you cannot use it to move or copy files from one location to another in the Finder, but it will help when managing lengthy and sometimes complex file paths, or the paths of more than one selected item.
via How to copy a file path in OS X | MacFixIt – CNET Reviews.