#PARAMETERS START
#PARAMETER directory STRING DEFAULT "c:\\temp" VALUE "/sample" SESSION "Directory" CAPTION "Directory to monitor"
my $directory;
$directory = "/sample";
$Session->Value('Directory', $directory);
#PARAMETER threshold INT DEFAULT 100 VALUE 100 SESSION "Threshold" CAPTION "Threshold, Number of Files"
my $threshold;
$threshold = 100;
$Session->Value('Threshold', $threshold);
#PARAMETERS END
use File::Find;
my $size = 0;
find(sub { $size += "1" if -f $_ }, $directory);
$Session->Value('CurrentSize', $size);
if ($size > $threshold)
{
$Rule->Status(1);
}
else
{
$Rule->Status(0);
}
Comments
You can follow this conversation by subscribing to the comment feed for this post.