tags:

views:

307

answers:

1

Does anyone know how I can determine the server and share name of a mapped network drive?

For example:

import win32file, win32api
for logDrive in win32api.GetLogicalDriveStrings().split("\x00"):
  if win32file.GetDriveType(logDrive) != win32file.DRIVE_REMOTE: continue
  # get server and share name here

Is there a handy api call for this?

Thanks.

+1  A: 

You'll have to call the win32 API: WNetGetUniversalName

Brian R. Bondy
Thanks Brian, works perfectly and would have taken me forever to find that API call.
Mark
glad it helped :)
Brian R. Bondy
I think the example code link is now broken.
badp
@bp: Just removed it.
Brian R. Bondy