in reply to Total size of each Directory

my first thought would be to just run du on your command line.
If you want to do it in perl the -s filetest will give you the size of a file