folder = sum([sum(map(lambda fname: os.path.getsize(os.path.join(directory,
    fname)), files)) for directory, folders, files in os.walk(path)])
MB = 1024 * 1024.0
print('%.2f MB' % (folder / MB))
Получить размер папки на сервере Linux