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.
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; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Disk Space used by a folder (and sub folders)
by dws (Chancellor) on Jan 25, 2001 at 22:20 UTC | |
by $code or die (Deacon) on Jan 25, 2001 at 23:52 UTC | |
by AltBlue (Chaplain) on Jan 26, 2001 at 23:29 UTC | |
by $code or die (Deacon) on Jan 27, 2001 at 07:03 UTC | |
by AltBlue (Chaplain) on Jan 27, 2001 at 15:56 UTC | |
|
Back to
Cool Uses for Perl