what you need is recursion, this is a function that will call itself when a certain check returns true or false.
Atm, your script will only loop over the first dir, and then stop. If you want it to loop over all subdirs as well, you will have to keep looping over every dir, and since you don't know how many dirs there are on your folder, you don't know how many while loops you will have to write.
Here's a script (just a copy of yours, but slightly changed), tha will loop over every subdir, and will store the number of files and the number of sizes:
UnrealEd