# HFS path in Terminal?



## ravenwaver (Oct 9, 2007)

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


----------



## Mikuro (Oct 9, 2007)

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.


----------



## ravenwaver (Oct 9, 2007)

That is just what I was Looking for!!!

Thank you OSX Master!!!

Paul


----------

