How to check for remaining hard drive space in Windows?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Mar 1 06:41:48 EST 2007
En Wed, 28 Feb 2007 18:54:53 -0300, kevinliu23 <kevinliu23 at gmail.com>
escribió:
> It's great because I don't even have to worry about the computer name.
> A question regarding the rootPath parameter...how would I be passing
> it? Would I be passing it as...
>
> tuple = win32api.GetDiskFreeSpace(r'C:')
> or just leave it blank and the function will automatically use the
> rootPath of where the .py file resides?
For GetDiskFreeSpace, the argument *must* end in \, so you should use
GetDiskFreeSpace('C:\\')
Using GetDiskFreeSpaceEx, it can be any directory. If you leave it, the
current directory (or current disk) is used - this may or may not be the
directory where the .py resides.
About the 2GB limit, it only applies to Win98 and earlier. Since the ...Ex
function works on 98 too, unless you need to support Win95, it's easier to
use that function.
And you can use UNC paths too, so it may even be used for querying
available space on remote machines, but I've never tried it that way.
--
Gabriel Genellina
More information about the Python-list
mailing list