Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import glob
- # Grab directory
- print("Directory path:", end='')
- directory = input()
- print("Searching in "+directory)
- # Scripts
- total_scripts = 0
- total_lines = 0
- total_populated_lines = 0
- total_chars = 0
- total_words = 0
- total_classes = 0
- total_components = 0
- print("Processing....")
- for path in glob.iglob(directory + "/**/*.cs", recursive=True):
- total_scripts += 1
- with open(path, 'r', encoding="utf8") as f:
- for line in f:
- total_lines += 1
- total_chars += len(line)
- total_words += len(line.split())
- if len(line) > 0: total_populated_lines += 1
- if " class " in line: total_classes += 1
- if " : MonoBehaviour" in line: total_components += 1
- print("Total files:",total_scripts)
- print("Total lines:",total_lines)
- print("Total populated lines:", total_populated_lines)
- print("Total chars:",total_chars)
- print("Total words:",total_words)
- print("Total classes:", total_classes)
- print("Total components:", total_components)
- # Materials
- paths = glob.glob(directory + "/**/*.mat", recursive=True)
- print("Total materials:",len(paths))
- # Images
- file_types = ('*.jpg', '*.jpeg', '*.png', '*.tif', '*.tiff', '*.webm')
- paths = []
- for t in file_types:
- paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
- print("Total images:",len(paths))
- # Sounds
- file_types = ('*.mp3', '*.ogg', '*.wav')
- paths = []
- for t in file_types:
- paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
- print("Total sounds:",len(paths))
- # Models
- file_types = ('*.fbx', '*.obj', '*.3ds', '*.blend')
- paths = []
- for t in file_types:
- paths.extend(glob.glob(directory + "/**/" + t, recursive=True))
- print("Total models:",len(paths))
- # Results
- print("---")
- print("You will have to continuously type",round(total_words/65/60, 2),"straight hours on average")
Advertisement
Add Comment
Please, Sign In to add comment