Friday, February 24, 2017

How to copy a file path on a Mac

This is obscure, but I ran across this recently and thought it might help someone else out. I frequently need to copy the path to a file on my Mac or on a server, so that I can include that path in documentation or in a support email with a customer. Here’s how to do it:

1. Select the file you want in the Finder

2. Choose File > Get Info (command-i)

3. Select the full path next to “Where” in the Get Info dialog box

Screenshot 2017 02 24 08 47 46

4. Choose Edit > Copy (command-c)

The file path is now on the clipboard, and can be pasted into a text document or an email. The path will look like this after pasting:

/Users/keithgilbert/Dropbox/Stock/Vector/Open Clipart Library/openclipart-0.18-svgonly/clipart/education


I just discovered by reading Dan Rodney’s excellent list of Mac Keyboard Shortcuts that if you select a file in the finder and press command-option-c the path name is copied. This method also puts the filename on the end of the path, so in my example above, the result is:

/Users/keithgilbert/Dropbox/Stock/Vector/Open Clipart Library/openclipart-0.18-svgonly/clipart/education/logaritmic_diagram_01.svg


Jamie McKee at MacKey Composition alerted me to this: You can right-click on a file or folder in the Finder, and then hold down the option key and choose “Copy [filename] as Pathname”. 

Wow. I had no idea there were so many ways to do this. Good to know!




Justin_P said...

Very helpful, Keith!

Sarah said...

This is great! Shared it with the team. Thank you!

- Netify - said...

Update - on MacOS High Sierra: you have to select the file, then hold down option and click the 'Action' (gear) button on the toolbar, to find the 'copy ... as path' option.

Maxwell said...

OSX 10.11+ users can use:
Option (⌥) – Command (⌘) – C