Re: How to check for remaining hard drive space in Windows?
- From: Tim Golden <mail@xxxxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 21:16:28 +0000
[... re getting free disk space ...]
Sick Monkey wrote:
Here you are:
>>> from win32com.client import GetObject... print disk.Name, disk.FreeSpacewmiObj = GetObject("winmgmts:\\\\MGW01641\\root\\cimv2")
diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk")
for disk in diskinfo:
...
A: None
C: 16978259968
D: None
Well it's not often someone beats me to a WMI
solution :) Just to be different, you can also
look at the GetDiskFreeSpace function in the
win32api module of the pywin32 extensions.
The doc says: """
tuple = GetDiskFreeSpace(rootPath)
Retrieves information about the specified disk, including the amount of free space available.
Parameters
rootPath : string
Specifies the root directory of the disk to return information about. If rootPath is None, the method uses the root of the current directory.
Win32 API References
Search for GetDiskFreeSpace at msdn, google or google groups.
Return Value
The return value is a tuple of 4 integers, containing the number of sectors per cluster, the number of bytes per sector, the total number of free clusters on the disk and the total number of clusters on the disk.
If the function fails, an error is returned.
"""
TJG
.
- Follow-Ups:
- Re: How to check for remaining hard drive space in Windows?
- From: kevinliu23
- Re: How to check for remaining hard drive space in Windows?
- References:
- How to check for remaining hard drive space in Windows?
- From: kevinliu23
- How to check for remaining hard drive space in Windows?
- Prev by Date: Re: New to Tkinter GUI building
- Next by Date: Re: Extract String From Enclosing Tuple
- Previous by thread: How to check for remaining hard drive space in Windows?
- Next by thread: Re: How to check for remaining hard drive space in Windows?
- Index(es):
Relevant Pages
|