You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to get a clean file path in OS X Yosemite?

I need to get file paths for Stata. Before Yosemite, I have to bare with the cmd+I and copy from the information panel. After I upgrade to Yosemite, cmd+I gives me a path look like this: User -> file1-->.... Now, I need to delete E-V-E-R-Y --> after I copy this path into Stata in order to set up the working directory. Is there a way I can work around with this and get a simple clean file path such as \user\aaa\aaa\aaa\aaa.

Thanks.

MacBook Pro, OS X Yosemite (10.10)

Posted on Oct 19, 2014 4:42 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 19, 2014 5:02 PM

Drop the file into a Terminal window.

40 replies

May 7, 2015 7:54 AM in response to cynthy_macprouser

Looks like this post is fairly old, but I recently updated to Yosemite and was disappointed to see this feature missing.


However, I discovered that while the display isn't the same as before, you can still highlight all of the new text and copy/paste this to another program. It will maintain the proper directory structure in a text format when pasting. This is how I most frequently use this feature, so while the display isn't the same, the usefulness of the feature is still there.

Dec 5, 2015 9:09 AM in response to cynthy_macprouser

User uploaded file

Using AppleScript that is compiled into an application, I pressed the command key and drag/dropped that application onto the Finder toolbar. With one or more Finder items selected, it will pop a dialog with each file presented accordingly. Optionally, I replaced the standard Script icon with another borrowed from OS X. The steps to arrive at the above appear lengthy, but are not complicated and should take about 10 minutes without the optional icon steps.


Example:

User uploaded file


Code:


tell application "Finder" to set theSel to selection as alias list

if (count of theSel) is equal to 0 then

display alert "No Finder item(s) selected. Quitting." as critical giving up after 5

return quit

end if

repeat with k from 1 to count of theSel

set item k of theSel to POSIX path of item k of theSel

end repeat

set tid to AppleScript'stext item delimiters

set AppleScript'stext item delimiters to return

-- panel will disappear on its own after 15 seconds

display dialog (items of theSel) as text with title "Finder Selection POSIX Path" giving up after 15

set AppleScript'stext item delimiters to tid

return

Steps:

  1. Copy/paste the above AppleScript into the AppleScript/Script Editor
  2. Click the hammer in the toolbar to compile
  3. File menu : Save…
    1. Name it posix_path
    2. Location: where you want
    3. File Format: text (.applescript will be the file extension now)
    4. Line Endings: (ignore)
    5. Hide Extension: unchecked
    6. Save
  4. Option + File menu : Save As…
    1. Name: POSIX path
    2. Location: Desktop
    3. File Format: Application

      Options: unchecked

    4. Hide Extension is checked now
    5. Save
  5. Open new Finder window
    1. command key + drag/drop POSIX path application to the Finder window toolbar
    2. This is an alias to the application on the Desktop.
    3. Select file/folder icons and click the new toolbar POSIX path item.
  6. Optional custom application icon
    1. Find a System Icon
      1. In Finder, press shift+command+G
      2. Copy/paste the following into that window, and then press Go
      3. /System/Library/CoreServices/CoreTypes/Contents/Resources
      4. In the resulting Finder window, press command+J, and select show icon preview.
      5. Option Drag/Drop (copy) the Toolbarinfo.icns file to your Desktop
    2. Right-click on your newly compiled POSIX path application
    3. Show Package Contents
    4. Double-click Contents
    5. Double-click Resources
    6. Rename applet.icns to applet.icns.bak
    7. Drag/Drop the Toolbarinfo.icns into the Resources folder, and rename it to applet.icns
    8. Close this Window
    9. In the Finder, press option+command+esc to force quit the Finder (restart it). The new application icon should be present, or will be shortly.

Jun 6, 2016 5:31 AM in response to VikingOSX

I haven't "upgraded" to Yosemite because I hate the new flattened, no-visual-cues design and I've been very happy with Mavericks. I find it outrageous that I should have to use TERMINAL or other ridiculous workarounds to simply find a file path. For Pete's sake to the person who said, "Most users won't ever need to know a file path" are you out of your mind? There are those of us who would actually like to know where our files reside. Whoa. Radical, I know.


I found the easiest thing to do is go to Finder then select VIEW and SHOW PATH BAR. Then in the finder window, do a search for your document / file and you'll be able to see the path at the bottom of the Finder window.


It's utter insanity to have to work that hard to do something so basic. Yeesh.


Thanks to UserName121 on the previous page for the heads up on enabling that function! I'm just hoping that when I am forced to migrate to Yosemite that the same function is present in Finder.

Jul 23, 2016 9:49 AM in response to cynthy_macprouser

Better late than never. This may be a new addition in El Capitan, but you can try it to see if it works in older versions of OS X.


Highlight any file or folder, then press Command+Option+C. Go to any app you can paste text into and press Command+V.


Works beautifully. I highlighted a deeply buried file for Perfect Mask and pasted it into TextEdit with this result:


/Volumes/Yosemite/Applications/Perfect Mask 8/Plug-in Files/Perfect Mask/Perfect Mask 8.ApertureEdit

How to get a clean file path in OS X Yosemite?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.