Have you ever wanted to just get the complete path to a file and use it in aÂ text editor? I find I do more often these days, particularly when trying to explain to someone where they might find a preference file, for example. I’m sure there used to be the ability to copy the file path to the clipboard in earlier versions of Mac OS, but in OSX it isn’t there.
You can get utilities that add that functionality, of course, but I was playing with Automator again, and thought I’d give it a go. It turns out to be extraordinarily easy!
Run Automator, set it to work with FIles and Folders, and add the first of two commands: ‘Get Selected Finder Items’. Now add the second commans from the ‘Utilities’ section: ‘Copy to Clipboard’.
That’s it. Really.
Now go to the ~/Library/Workflows/Applications/Finder folder and put your workflow in there. It will now appear in the contextual menu, under ‘Automator’ for any file or folder you have got. When you click it, wait a moment for a slight ‘flash’ to appear on screen and you know you’ve got the path in your clipboard.
If you need to replace the Unix style separators with a forward slash, or replace the full path to show a ’tilde’ character (as in the example above) then simply add a third command in between the two you’ve just done – use the ‘Text’ tools and run a ‘Search and Replace’ command to find ‘:’ and replace with ‘/’. You might also want to replace ‘Users/accountname/’ with simply ‘~/’ or even ‘User Account/’ or whatever you want. Add another workflow item before the ‘Copy to Clipboard’ command.
Then, pick any file or folder anywhere on your system, control (right) click on it and select ‘More’ at the bottom of the menu, then ‘Automator’ then the name of your workflow. You’ll then be able to paste it into any text document you wish. You can download my workflow file HERE.