> You have to walk the directory tree and sum each file's size.  Windows
does this too
> - try your right-click properties on a large directory and see how long it
takes.
> That's also what du does.  There are, however, some recipes that should
make this 
> fairly simple for you - try this:

> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/86554

The above uses os.listdir(), which I've had problems with in the past with
huge directories (I can't recall, but I suspect it was simply performance
that sucked).  Either way, the fastest I've come up with has been based
around:

    for fd in win32file.FindFilesIterator(os.path.join(dir, "*")):
        name = fd[8]
        if name in ('.', '..'):
            continue

See the docs for how the 'fd' tuple is laid out.

Cheers,
 
Mark

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to