inkedmn
08-05-2002, 01:22 PM
since Strike, Vince, and i have decided to take another whack at PyNetMonTool, it became apparent that getting basic system info with python couldn't be done without these extensions.
so, i wrote a little program to get the free space on a windows volume.
here you go...
# Get free disk space
import win32file, sys
def freeSpace(drive):
space = win32file.GetDiskFreeSpaceEx(drive)
free = float(space[2]) / 1000000000
free = str(free)
return free[:5]
if __name__ == '__main__':
drive = sys.argv[1]
y = freeSpace(drive)
print y, "gigabytes free"
the win32 exetensions have a PANTLOAD of stuff...
[edit]
btw, here's the output:
C:\python\pynetmontool>python getfree.py c:
3.822 gigabytes free
so, i wrote a little program to get the free space on a windows volume.
here you go...
# Get free disk space
import win32file, sys
def freeSpace(drive):
space = win32file.GetDiskFreeSpaceEx(drive)
free = float(space[2]) / 1000000000
free = str(free)
return free[:5]
if __name__ == '__main__':
drive = sys.argv[1]
y = freeSpace(drive)
print y, "gigabytes free"
the win32 exetensions have a PANTLOAD of stuff...
[edit]
btw, here's the output:
C:\python\pynetmontool>python getfree.py c:
3.822 gigabytes free