[Tutor] getUncPath(mappedDrive)
danz
zemke at yahoo.com
Wed Jan 29 22:58:04 CET 2014
Tim.
I came across your code while searching for a similar need. Your post was
the best I could find on the subject. Perhaps more importantly, you showed
me that going down the ctypes rabbit hole can be less intimidating than I
assumed. Thanks!
My use case was a little different than the original poster's. I need to
retrieve the network paths for all of the mapped drives that are currently
connected. I chose a different implementation, that seems to work well. I
would appreciate any comments you have on this approach.
BTW, Thank you for the information on your website. Your information and
pointers to GetDriveType() and GetVolumeInformation() helped me a a lot.
Dan
-------------------
import subprocess
def available_network_drives():
net_drives = dict()
for line in subprocess.check_output(['net', 'use']).splitlines():
if line.startswith('OK'):
fields = line.split()
net_drives[fields[1]] = fields[2] # [1] == key, [2] ==
net_path
return net_drives
print available_network_drives()
--
View this message in context: http://python.6.x6.nabble.com/Tutor-getUncPath-mappedDrive-tp4652304p5045727.html
Sent from the Python - tutor mailing list archive at Nabble.com.
More information about the Tutor
mailing list