retrieve server name from a Share's finder info

Hi all–

Lets say that I have a mounted share called “Stuff”. when I look at the Finder Info for the mounted share, i see the server’s name: “Server: afp://servername/Stuff” or via smb: “Server: smb://servername/Stuff”. Is there a way to get the ‘Server’ string from Finder Info via AS or Terminal?

Thanks.

System Events “knows”. Assuming you know the name of the share, then:

tell application "System Events" to set tServer to server of disk "diskName"

If you don’t know the name (or at least the script doesn’t), then the following will get a list of names and servers, where the servers of all the local disks will show up as “missing value” and all the remotes will show name and server.

tell application "System Events" to set I to {name, server} of disks

Hi,

I wrote a little Foundation Tool CLI called serverurl to retrieve the url string
syntax is very easy: serverurl mountpath
The CLI throws an error, if the path is not valid or the volume is no shared volume


set theVolume to "/Volumes/myVolume"
try
	do shell script "/path/to/serverurl " & quoted form of theVolume
on error
	-- no server
end try

I tested it successfully with afp shares.
If it doesn’t work with smb shares, please download FSMegaInfoGUI at http://zeroonetwenty.com/code/
and post the result of FSCopyURLForVolume