I need a function to determine if a directory is a mount point for a drive. I found this code already which works well for linux:
def getmount(path):
path
Here is some code to return the UNC path pointed to by a drive letter. I suppose there is a more slick way to do this, but I thought I'd contribute my small part.
import sys,os,string,re,win32file
for ch in string.uppercase: # use all uppercase letters, one at a time
dl = ch + ":"
try:
flds = win32file.QueryDosDevice(dl).split("\x00")
except:
continue
if re.search('^\\\\Device\\\\LanmanRedirector\\\\',flds[0]):
flds2 = flds[0].split(":")
st = flds2[1]
n = st.find("\\")
path = st[n:]
print(path)