I find stuff like this easier to do with a shell command but if it needs to be portable then use the File::Find module or write your own function to recurse directories and add up the file sizes. You can use the -s file test operator to get the size.