Skip to content

Instantly share code, notes, and snippets.

@fictorial
Created September 14, 2021 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fictorial/c54e53feb9b547b921bfc30de3851426 to your computer and use it in GitHub Desktop.
Save fictorial/c54e53feb9b547b921bfc30de3851426 to your computer and use it in GitHub Desktop.
import os
import sys
counts = dict()
for root, dirs, files in os.walk(sys.argv[1]):
for filename in files:
full_path = os.path.join(root, filename)
base, ext = os.path.splitext(full_path)
if len(ext) == 0:
if '.git' in full_path:
ext = '<git object>'
counts[ext] = counts.setdefault(ext, 0) + 1
for k, v in sorted(counts.items(), key=lambda x:x[1], reverse=True):
print(k, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment