Browse Source

GetDirectorySize

rdb 16 years ago
parent
commit
e34bfa9591
1 changed files with 9 additions and 0 deletions
  1. 9 0
      makepanda/makepandacore.py

+ 9 - 0
makepanda/makepandacore.py

@@ -252,6 +252,15 @@ def GetDirectoryContents(dir, filters="*", skip=[]):
     results.sort()
     results.sort()
     return results
     return results
 
 
+def GetDirectorySize(dir):
+    size = 0
+    for (path, dirs, files) in os.walk(dir):
+        for file in files:
+            try:
+                size += os.path.getsize(os.path.join(path, file))
+            except: pass
+    return size
+
 ########################################################################
 ########################################################################
 ##
 ##
 ## LocateBinary
 ## LocateBinary