[python-win32] How to get Worgroup list?

Brad Tilley rtilley at vt.edu
Tue Jan 10 13:55:52 CET 2006


Quoting Karlo Lozovina <kl at mosor.net>:

> Friday, January 6, 2006, 9:33:26 AM, you wrote:
>
> > http://groups.google.com/group/comp.lang.python/msg/d448ab26621ee8bf
> > http://groups.google.com/group/comp.lang.python/msg/2aa365a285899845
> > http://groups.google.com/group/comp.lang.python/msg/461ee641b16c2f96
>
> Those three were really helpful, thank you.
>
> > I'm not 100% sure that the code which lists domains
> > does the same for workgroups; I just hope so.
>
> It does, works just fine.
>
> But, I have further problems now. Now when I have list of shares I want
> to get a list of directories and files within a share, and for every
> file it's size.
>
> I can get directory and file listing with os.listdir() (btw, how do I
> set apart directories and files?),

os.walk() perhaps like this:

for root, dirs, files in os.walk(DIRECTORY):

    for f in files:
        print f

    for d in dirs:
        print d


> but how do I get filesize for every
> file?

os.stat()

for f in files:
     stats = os.stat(f)
     print stats


More information about the Python-win32 mailing list