sub get_dir {
my $dir = shift ;
opendir(DIR, $dir) || wlog( "Cannot open dir: $dir." );
my @files = grep !/^\.\.?$/, readdir DIR ;
closedir DIR;
return @files ;
}
####
#! /usr/bin/perl
# This one works
sub main {
@total1 = get_dir("\\\\RICH0417\\d\$\\wirein");
@total2 = get_dir("\\\\RICH0418\\d\$\\wirein");
@total = (@total1, @total2);
open (F, ">E:\\wirecount.txt")|| die("Cannot open file.");
print F ($#total + 1);
close F;
print STDOUT ".";
sleep 30;
main();
}
####
sub do_wire {
#Non-working....
my @wire1 = get_dir("\\\\RICH0417\\d\$\\wirein") || wlog("Cannot get wire1.");
my @wire2 = get_dir("\\\\RICH0418\\d\$\\wirein") || wlog("Cannot get wire2.");
my @wiretotal = (@wire1, @wire2);
my $wire = ($#wiretotal + 1);
my $wire = get_file("C:\\wirecount.txt");
if ($wire < 100) {
$wirestat = "green";
} else {
$wirestat = "red";
}
return $wire;
}
####
system("net use /USER:USERNAME Q: \\\\RICH0417\\d$\\Temp PASSWORD") == 0 && wlog("Q:\ Mounted");
####
14:28 1-17-2003 >> Cannot open dir: \\RICH0417\d$\wirein.
14:28 1-17-2003 >> Cannot get wire1.
14:28 1-17-2003 >> Cannot open dir: \\RICH0418\d$\wirein.
14:28 1-17-2003 >> Cannot get wire2.