[Tutor] getUncPath(mappedDrive)

Tim Golden mail at timgolden.me.uk
Sat Mar 24 21:22:14 CET 2012

On 24/03/2012 20:13, Albert-Jan Roskam wrote:
> Hi,
> Is there a function that takes a file path with a mapped drive
> (z:\blah) and returns the associated UNC path
> (\\server\share\ding\dang\dong\blah)? I looked in os.path, but it
> doesn't seem to have this. The link below seems to be a solution
> (code in the bottom of the page), but I can't install win32com.client
> in the office :-( Is there any built-in function?
> http://stackoverflow.com/questions/2244767/python-check-network-map

There's nothing built-in. The easiest function to emulate
through ctypes is probably WNetGetConnection:


(this is available from pywin32 via the win32wnet package
but I assume you can't install that either)


More information about the Tutor mailing list