#!/usr/bin/env python3
#-*- coding: utf-8 -*-

__author__ = 'suxoza'


import sys,os,json
try:
    dir            = sys.argv[1]
except IndexError:
    pass

def du_():
    dir_ = 0
    files_ = 0
    size_ = 0
    for(a,b,c) in os.walk(dir):
        try:
            dir_ = dir_+1
            size_ = size_ + os.path.getsize(a)

            for file_ in c:
                file_name = os.path.join(a,file_)
                size_ = size_ + os.path.getsize(file_name)
                files_ = files_+1
        except:
            continue

    dict_ = dict(files = files_,dirs = dir_,size=round((size_/1024)/1024,2))
    print(json.dumps(dict_))

if __name__ == '__main__':
    du_();
