if fixname in visitedif tracetryprint('skipping thisdirelsevisited add(fixnamefor filename in fileshereif filename endswith(extname)if trace tryprint('+++filenamefullname os path join(thisdirfilenametrybytesize os path getsize(fullnamelinesize sum(+ for line in open(fullname'rb')except exceptionprint('error'exc_info()[ ]elseallsizes append((bytesizelinesizefullname)for (titlekeyin [('bytes' )('lines' )]print('\nby % titleallsizes sort(key=lambda xx[key]pprint pprint(allsizes[: ]pprint pprint(allsizes[- :]unlike the prior tree versionthis one allows us to search in specific directoriesand for specific extensions the default is to simply search the current working directory for python filesc:\pp \system\filetoolsbigext-tree py by bytes [( \\__init__ py')( \\bigpy-dir py')( \\bigpy-tree py')[( \\join py')( \\bigext-tree py')( \\split py')by lines [( \\__init__ py')( \\bigpy-dir py')( \\bigpy-tree py')[( \\join py')( \\bigext-tree py')( \\split py')for more custom workwe can pass in directory nameextension typeand trace level on the command-line now (trace level disables tracingand the defaultshows directories visited along the way) :\pp \system\filetoolsbigext-tree py py by bytes [( \\__init__ py')( \\filetools\\__init__ py') quick game of "find the biggest python file