23 lines
433 B
Python
23 lines
433 B
Python
|
#!/usr/bin/python2.7
|
||
|
|
||
|
import os
|
||
|
|
||
|
|
||
|
path=("/boot", "/", "/home/")
|
||
|
|
||
|
print "mountpoints\tfree megabytes"
|
||
|
print "------------------------------"
|
||
|
for mountpoint in path:
|
||
|
if os.path.ismount(mountpoint):
|
||
|
fs = os.statvfs(mountpoint)
|
||
|
freembytes = fs.f_bavail * fs.f_bsize / 1024**2.0
|
||
|
print "%s\t\t%.1f MB" %(mountpoint, freembytes)
|
||
|
else:
|
||
|
print "error: given path is not a mountpoint"
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# end of file
|