Report actual disk size, not apparent size

This commit is contained in:
Jim Paris 2013-08-05 12:16:56 -04:00
parent 8db9771c20
commit 6de77a08f1

View File

@ -21,7 +21,8 @@ def du(path):
errors that might occur if we encounter broken symlinks or errors that might occur if we encounter broken symlinks or
files in the process of being removed.""" files in the process of being removed."""
try: try:
size = os.path.getsize(path) st = os.stat(path)
size = st.st_blocks * st.st_blksize
if os.path.isdir(path): if os.path.isdir(path):
for thisfile in os.listdir(path): for thisfile in os.listdir(path):
filepath = os.path.join(path, thisfile) filepath = os.path.join(path, thisfile)