Get 'unc' path in OSX of mounted share

后端 未结 1 636
眼角桃花
眼角桃花 2021-01-16 07:32

In python I am trying to get the \'unc\' path or server path of a mounted share. So I have a mounted share of:

/Volumes/D

How do I resolve

相关标签:
1条回答
  • 2021-01-16 08:16

    After looking into df, I came up with this which works excellent on OSX:

    from subprocess import Popen, PIPE
    
    df = Popen('df -P /Volumes/link/to/some/folder', shell=True, stdout=PIPE)
    serverAddress = df.stdout.readlines()[1:][0]
    serverAddress = serverAddress.split('@')[1]
    serverAddress = serverAddress.split('/')[0]
    print serverAddress
    
    0 讨论(0)
提交回复
热议问题