Calculate OS Size with Python
df.py #! /usr/bin/python # my first python attempt. # Mark Young 14 July 2016 import sys import os import subprocess def reportUsage(label, total, free): used = total – free print “%s=%dG, used=%dG (%d%%)” % (label, free, used, used*100/total) p = subprocess.Popen([“df”, “-k”, “.”], stdout=subprocess.PIPE) print p.stdout.read() rc = p.wait() stat = os.statvfs(“.”) total = (stat.f_bsize … Read more