http://www.perlmonks.org?node_id=18321


in reply to looking for simple solution

I'm not quite sure what you mean by the size of a directory. If what you want is the actual byte size of the directory itself, you can just do
$size = (-s $directory);
If what you mean by size is the size of everything within it, you'll probably have to code something up by hand, preferably using File::Find to handle your recursion. I did a quick look on CPAN, but was unable to find any modules to handle disk usage.

If you do want the size of everything in the directory, and you're on unix, you can mess around with playing with the output of the system command 'du', but I don't recommend this for any script that will have a long life.