Mac – copying a file’s path (string) to ClipBoard

How to copy a file’s path as a string:  

  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. 

  •  “You can copy the path right out of the Get Info window in Snow Leopard.”
  • (haven’t yet tried this)

Leave a Reply

You must be logged in to post a comment.