Is there a reason you're not using the os.walk function?
It sounds like it'll be easier to split this problem into two parts, one for recursively finding the size of a given root directory and another for finding all the subdirectories of a given root. Putting them both together should then give you the sizes you're looking for - assuming I understand the problem correctly.
It sounds like it'll be easier to split this problem into two parts, one for recursively finding the size of a given root directory and another for finding all the subdirectories of a given root. Putting them both together should then give you the sizes you're looking for - assuming I understand the problem correctly.