image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old October 9th, 2007, 12:19 PM
Registered User
 
Join Date: Jun 2002
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ravenwaver is on a distinguished road
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
Reply With Quote
  #2  
Old October 9th, 2007, 01:25 PM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,462
Thanks: 3
Thanked 10 Times in 9 Posts
Mikuro is on a distinguished road
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.2

I'm now a four-browser man. How on earth did this happen?!

Useful programs: PithHelmet, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
  #3  
Old October 9th, 2007, 01:51 PM
Registered User
 
Join Date: Jun 2002
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ravenwaver is on a distinguished road
That is just what I was Looking for!!!

Thank you OSX Master!!!

Paul
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 03:02 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.