find network drives, win

Emile van Sebille emile at fenx.com
Mon Nov 5 13:57:34 EST 2001


"Gerhard Häring" <gh_pythonlist at gmx.de> wrote in message
news:mailman.1004981779.14538.python-list at python.org...
> On Mon, Nov 05, 2001 at 04:51:10PM +0000, Marcus Stojek wrote:
> > Hi,
> >
> > under windows I have to find out for a given path whether the drive is
local
> > or a network drive (is "mounted" the right word for this?)
> > I tried:
> > -----------------------------------------------
> > import string
> > import os.path
> > [...]
>
> I think you cannot find that out with the standard Python libraries. I
propose
> you get the ActivePython distribution from ActiveState or install their
> Windows-Extensions, named win32all on top of your existing Python
installation.
>
> Then, check out the win32file module, and especially the GetDriveType()
> function there.
>
> Btw. the Windows extensions are *very* useful on Windows. They give you
access
> to a large part of the Windows API and you can use them to access most
ActiveX
> controls and do COM-automation of applications, such as MS Excel.
>

Seconded.

In a pinch, you can parse the results of:

info = os.popen('net use').readlines()


Emile van Sebille
emile at fenx.com






More information about the Python-list mailing list