Pat recently asked me if I knew a keyboard shortcut to quickly copy the path of a file or folder in finder, which I didn't know. It got me thinking how much this shortcut would help me too. What I have often done in that past, is quickly move a file to my desktop, so that the path is short and I immediately know what it is. However, it doesn't take long before your desktop becomes quite cluttered. So for anyone interested, here is how to quickly copy the path of a file or copy the path of a directory to your clipboard in Mac OSX.
After having right clicked on a file/folder you can hold down the option key (alt) and it switches some of the options in the menu. On OSX El Capitan, the 'Copy' option swaps out for 'Copy Path', perfect!
For those like me who are still on Yosemite (or earlier), this is not an option. However, you can set up a service and attach a keyboard shortcut to copy the path of the selected file/folder. To do this:
- Download Copy-Path-as-Text.zip
- Extract the .workflow file into '/Users/[username]/Library/Services/'
Once you have done this, you should be able to right click on any file or folder and go to 'Services', and there will be an option for 'Copy Path as Text'.
If you want a keyboard shortcut for the above, assign one by going to:
- System Preferences > Keyboard > Shortcuts > Services > Copy Path as Text
I have used 'Command + Control + Option + C', which apparently clashes with something else, but I don't know what, and I can't see it doing anything so I don't care - unfortunately all of the good shortcuts are taken.
I have already used the shortcut to write this blog post!
Enjoy.