3 from __future__
import print_function
5 from operator
import itemgetter
17 for (path, dirs, files)
in os.walk(dirIn):
19 if 'CVS' in path:
continue 20 if '.glimpse_' in path:
continue 21 if 'Configuration/PyReleaseValidation/data/run/' in path:
continue 24 if '.glimpse_index' in file:
continue 25 fileName = os.path.join(path, file)
26 fileSize = os.path.getsize(fileName)
27 if path
in self.dirSizes.keys() :
31 if os.path.isfile(fileName):
37 jsonFile = open(jsonFileName,
'w')
40 print(
'treeInfo info written to ', jsonFileName)
41 except Exception
as e:
42 print(
"error writing json file:",
str(e))
46 pklFileName = self.outFileName.replace(
'.json',
'.pkl')
47 pickle.dump([os.path.abspath(dirIn), self.
dirSizes, self.
fileSizes], open(pklFileName,
'w') )
48 print(
'treeInfo info written to ', pklFileName)
49 except Exception
as e:
50 print(
"error writing pkl file:",
str(e))
57 topDirs = sorted(self.dirSizes.items() , key=itemgetter(1), reverse=
True)
58 topFiles = sorted(self.fileSizes.items(), key=itemgetter(1), reverse=
True)
65 print(
"found ",len(emptyFiles),
"empty files. ")
67 print(
"found ", len(self.
dirSizes),
'directories, top 10 are:')
81 opts, args = getopt.getopt(sys.argv[1:],
"c:o:", [
'checkDir=',
'outFile='])
85 for opt, arg
in opts :
87 if opt
in (
'-c',
"--checkDir", ):
90 if opt
in (
'-o',
"--outFile", ):
94 ta.analyzePath(checkDir)
97 except getopt.GetoptError
as e:
101 if __name__ ==
'__main__':
def __init__(self, outFileName)
def analyzePath(self, dirIn)
S & print(S &os, JobReport::InputFile const &f)