http://qs1969.pair.com?node_id=54267

pass this subroutine the path (can be a UNC path!) and it will return the amount of disk space that the folder (and its subfolders) use in bytes.

I was previously using a couple of subs in a very confusing loop, but this is neater, and faster I hope.
use File::Recurse; sub GetFolderSize { my $Path = shift; my $size = 0; recurse { $size += -s } $Path; return $size; }