Getting a POSIX path of a folder on a server

hello,
I am trying to figure out how to return a POSIX path to a folder on t he server.
This is what I have, but it is not working?
thanks
babs

tell application "Finder" to get the POSIX path of (folder "babs" of disk "MacServer" of "Finder")

Hi,

a mounted server is located in /Volumes, the POSIX path looks like

/Volumes/MacServer/babs

Hello.

Thought I’d just mention that you can always drag a file into a terminal window to see it’s path.
You can even drag a file into AS Script Editor to ditto - at least if you are on a Snow Leopard machine.

Best Regards

McUsr

Hi Stefen :wink:
Yeah, I can write the path OK, I was just practicing how to get it returned in the result box.
Probably not necessary, if I can write it, but just trying to make sense of all this stuff…
thanks!!
babs

Thanks McUsr-Good to know :wink:

respective this script you can coerce a POSIX path from a HFS path without the Finder

get the POSIX path of "MacServer:babs:" --> /Volumes/MacServer/babs/

Note: if the server is not mounted you get the result “/MacServer/babs/”

Hello.

I’ll spin a little further on the idea of dragging the folder into either a Terminal window or a Script Editor window.

Then you can just copy the path, embed it with " and use it directly without any ado. Kind of practical when it is for a static path that you know in advance will exist. -I’ve added a check that makes it bail out if it does not exist in the snippet below.
This script works under Snow Leopard. ( With a real path :slight_smile: )


set o to "/Users/copied/path/directly/into/Script Editor"
	try
		POSIX file o as alias
	on error
		display alert "O does not  exist ~ Exits" ” On some later date.
		error number −128
	end try
	tell application "System Events"
		set l to (get properties of folder o )
	end tell
	tell application "Finder"
		set ll to every file of folder POSIX file  o
	end tell

Its always good to have some alternatives.

Best Regards

McUsr

Here’s a little something I keep around as a reference:

set theUnixPath to "/Users/Shared/"
(POSIX file theUnixPath) as string
--> "Macintosh HD:Users:Shared:"
set theMacOSXPath to "Macintosh HD:Users:Shared:"
POSIX path of theMacOSXPath
--> "/Users/Shared/"

Maybe it will be helpfull to someone as it has been to me. :slight_smile:

Browser: Safari 531.9
Operating System: Mac OS X (10.6)