Skip to content

Instantly share code, notes, and snippets.

View bogdanp05's full-sized avatar
👽

Bogdan Petre bogdanp05

👽
  • aiven.io
  • Berlin
View GitHub Profile
@bogdanp05
bogdanp05 / file_types.py
Last active November 16, 2018 10:45
Get a list of number of files and size of files for all file types in a directory. Example: "python file_types.py ./dir_path"
import os
from os.path import join, getsize
import argparse
import operator
def parse_args():
parser = argparse.ArgumentParser(description='Count the number of files for each file type in a directory.')
parser.add_argument('path', metavar='p', type=str, help='path of the directory')
parser.add_argument('-threshold', metavar='t', type=int, default=10,