Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Results 1 to 3 of 3
  1. #1
    ravenwaver is offline Registered User
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HFS path in Terminal?

    Hi - I would like to use the 'open -a finder' command in the terminal with a HFS path - is that possible?

    ie:
    open -a finder "Macintosh HD:Users"

    Thanks

    Paul

  2. #2
    Mikuro's Avatar
    Mikuro is offline Crotchety UI Nitpicker
    Join Date
    Mar 2005
    Posts
    2,832
    Thanks
    8
    Thanked 74 Times in 64 Posts
    As far as I know, there's no simple way to do that. There are some complicated ways, though.

    I often need to convert paths from one type to another with AppleScript, where it's fairly easy:

    return POSIX path of file "Macintosh HD:Users" --returns "/Users"
    ...and the reverse...
    return posix file "/Users" --returns file "Macintosh HD:Users"

    You can embed AppleScripts in terminal commands by using the "osascript" command (the reverse is also true with AppleScript's "do shell script" command). What's more, you can pass the result of one terminal command as a parameter for another by encasing it in ` characters. That means that this method can be applied directly in Terminal.

    Depending on why and how you need to do this, it might be unforgivably inelegant, but you be the judge. Anyway, here's the final command:

    open -a finder `osascript -e 'return POSIX path of file "Macintosh HD:Users"'`

    That's probably not the only way to do it, but I'm sure any other way would use a similar technique.
    Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.8
    MacBook Pro — 2.26GHz C2D, 8GB RAM — OS 10.6.8

    Useful programs: Privoxy, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc

  3. #3
    ravenwaver is offline Registered User
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is just what I was Looking for!!!

    Thank you OSX Master!!!

    Paul

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •