From e34bfa9591145e123584ea03af7e4ade25824aba Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Nov 2009 19:51:23 +0000 Subject: [PATCH] GetDirectorySize --- makepanda/makepandacore.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index e0f2e1d807..b5a934d912 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -252,6 +252,15 @@ def GetDirectoryContents(dir, filters="*", skip=[]): results.sort() 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