[python-win32] GetDiskFreeSpaceEx

Tim Golden mail at timgolden.me.uk
Tue Jul 13 16:10:42 CEST 2010


On 13/07/2010 14:50, Vittorio Zuccala' wrote:
> Hi all,
> i'm new in this mail-list and in python's programming.

Welcome to Python and to this group.

> I'm searching information about getting free disk space on win32 systems...
>
> I found example about win32 programming in python in Tim's site at this link
> http://timgolden.me.uk/python/win32_how_do_i/lock_my_workstation.html and
> information about Free Disk Space at this link:
> http://msdn.microsoft.com/en-us/library/aa364937%28VS.85%29.aspx

If you haven't already, get hold of the pywin32 extensions to Python:

   https://sourceforge.net/projects/pywin32/

They contain a *lot* of the Win32 API that you'll need. Including
the one you're after:

 
http://timgolden.me.uk/pywin32-docs/win32api__GetDiskFreeSpaceEx_meth.html

So if you had the modules installed, the code would look something like 
this:

<code>
import win32api

n_free_user, n_total, n_free = win32api.GetDiskFreeSpaceEx ("c:/")
print ("Total disk size: %d bytes" % n_total)

</code>

TJG


More information about the python-win32 mailing list