python 获取指定文件夹的大小

 

def getdirsize(dirpath):
    size = 0
    for root, dirs, files in os.walk(dirpath):
        size += sum([getsize(join(root, name)) for name in files])
    return size

 

posted @ 2019-01-02 16:04  anobscureretreat  阅读(711)  评论(0编辑  收藏  举报