Copy and paste the full path of a file in the Finder

Finder iconThis is a handy trick that I use from time to time. Say you’ve selected a file or folder in a Finder window, and you want to copy the full path to that file or folder as a text string – for pasting into an email or a script, for example. Here’s how:

  1. Open a Terminal window.
  2. Drag the file or folder to the Terminal window. (The full path appears in the window.)
  3. Select the path in the Terminal window, copy it, and paste it into your email or script.
  4. Close the Terminal window.

The only slight snag is that, if your file or folder path contains spaces, the spaces get escaped with ‘\’s in the Terminal window.

If the escaped spaces bug you, or you often want to copy the path to a file, check out the catchily-titled FilePathToClipCMPlugin. Download and open the .dmg, drag the FilePathToClipCMPlugin.plugin file to ~/Library/Contextual Menu Items, and restart the Finder (Apple menu > Force Quit, then choose Finder in the list and click Relaunch). You can now right-click any file or folder and choose FilePathToClip! to copy it to the Clipboard. Works a treat.

(PathSnagger does a similar thing, but sadly it doesn’t have a stable Universal Binary version yet so I can’t test it.)

Bookmark this post:

11 Responses to “Copy and paste the full path of a file in the Finder”

  1. Alan Says:

    Word 04 for Mac doesn’t paste in full paths for file hyperlinks (and there’s no support doc addressing this that I could find anywhere, so this saves the day,

    thanks.

  2. Mechanoid Says:

    Super!!!
    It realy works!!!

  3. aaron Says:

    here’s a weird thing that’s happening to me, that seems semi-related: every time i try to paste something from word (using mac office 2004) to firefox it pastes the full file path before the text i’m trying to paste. anyone have this happen before and know how i can fix it? i’m stumped…

    thanks!

    aaron

  4. Matt Says:

    @aaron: Sounds strange. The full file path to the Word doc? Does it happen with other browsers?

  5. summer Says:

    Works. But rather lame that one has to do it this way. :-/

  6. ravi Says:

    really lame….why is that every simple thing in mac needs extra plugins..?? Plugin for right click menu, plugin for simple path copying..plugin for home/end keys…plugin to show USB devices…I’m really missing my windows days..

  7. Matt Says:

    @ravi: There’s no doubt that Mac OS X trades usability for features – often you need to use plugins or go “under the hood” to do some of the things that are more front-and-centre in Windows. Personally I like the tradeoff and love my Mac’s uncluttered UI and ease of use, but it’s not for everyone!

  8. Kamil Studios Says:

    Actually you can ‘right-click’ to the folder > ‘get info’
    the folder path is located in ‘Where:’ under ‘General info.
    then you can copy the path.

  9. Matt Says:

    Nice find Kamil! 🙂 I don’t think the “Where” field in the Get Info dialog was copyable in 10.4 (which was the current OS X when I wrote the post), but it is in 10.6. Very handy!

  10. Frustrated Says:

    Jesus that is laborious, why wouldnt finder integrate that? or at least a 3rd party up facilitate it. Apple have dropped the ball on this and cut/paste issue.

  11. Mac OS X: Copy and paste the full path of a file in the Finder (via: Reality Distortion) « The Wiert Corner – irregular stream of Wiert stuff Says:

    […] via: Copy and paste the full path of a file in the Finder — Reality Distortion: Macs, Mac OS X, and…. Rate this:Share this:LinkedInTwitterFacebookStumbleUponDiggRedditEmailPrintLike this:LikeBe the first to like this. […]