磁盘容量
所使用的API函数
win32api.GetDiskFreeSpace
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.
win32api.GetDiskFreeSpaceEx
tuple = GetDiskFreeSpaceEx(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 GetDiskFreeSpaceEx at msdn, google or google groups.
Return Value
The return value is a tuple of 3 integers, containing the number of free bytes available the total number of bytes available on disk the total number of free bytes on disk the above values may be less, if user-quotas are in effect
If the function fails, an error is returned.