macos 在 Mac OS X 上查找已安装网络共享的路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2159814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Finding the path of a mounted network share on Mac OS X
提问by millerdev
I'd like to find out where a network share is mounted when the mount command fails like this:
当 mount 命令失败时,我想找出网络共享的安装位置,如下所示:
$ mkdir ~/share
$ mount_afp afp://server/share ~/share
mount_afp: the volume is already mounted
This looked promising...
这看起来很有希望......
$ mount
... snip ...
afp_000000004oMw0q76003DF78u-1.2d000006 on /Volumes/share-1 (afpfs, nodev, nosuid, mounted by username)
afp_000000004oMw0q76003DF78u-2.2d000007 on /Volumes/share-2 (afpfs, nodev, nosuid, mounted by username)
It seems like there should be a way to map those long afp_000...
numbers to URIs... Is there any way to determine where a volume is mounted given its afp:// URI?
似乎应该有一种方法可以将这些长afp_000...
数字映射到 URI... 有没有办法确定卷的安装位置给定它的 afp:// URI?
I'm actually executing these commands with Python's subprocess module, so if there's a module or library that can do it that would be acceptable as well.
我实际上是用 Python 的 subprocess 模块执行这些命令,所以如果有一个模块或库可以做到这一点,那也是可以接受的。
回答by John N
Try /Volumes/PUBLIC
试试 /Volumes/PUBLIC
(Or whatever Get Info tells you after looking at the file with Finder)
(或使用 Finder 查看文件后获取信息告诉您的任何内容)
That's what worked for me.
这就是对我有用的东西。
回答by prodigitalson
Do you mean where it mounted on the remote server or where its mounted locally? If youre talking on the local system the mountpoint should be in /Network/Servers unless otherwise specified by fstab, autofs or an arg to mount. You could scan /Network/Servers for the share name...
你的意思是它安装在远程服务器上的位置还是本地安装的位置?如果您在本地系统上交谈,除非 fstab、autofs 或要挂载的 arg 另有指定,否则挂载点应在 /Network/Servers 中。您可以扫描 /Network/Servers 以获取共享名...