# Acquire the Local Time Array
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# Convert less the "10" so they equal a two char date.
$Month = $mon + "1";
if ($month < "10"){
$Month = '0' . "$Month";
}
if ($mday < "10"){
$mday = '0' . "$mday";
}
# Get the last two digits of a year, the way DOS sees file names.
$RealYear = substr($year, 1);
# This created $TimeStampDate into a format found in a DIR command in DOS. Ex. 03/28/01.
$TimeStampDate = "$Month". "/". "$mday" . "/" . "$RealYear";
####
sub CreateCmdFile {
$FileName = 'D:\\Perl\\pl\\Check\\' . "$CurrentServerName" . '.cmd';
unlink($FileName);
open(servercmd, "> $FileName");
print servercmd '@echo off' . "\n";
$VeritasLocation = '"\\\\' . "$CurrentServerName" . '\\C$\\Program Files\\Veritas\\Backup Exec\\NT\\Data\\*.txt"';
print servercmd 'dir ' . "$VeritasLocation" . ' > D:\\Perl\\pl\\Check\\' . "$CurrentServerName" . '.txt';
close(servercmd);
system("$FileName");
}
####
sub FindMatchingDates {
$ServerDirectoryFile = 'D:\\Perl\\pl\\Check\\' . "$CurrentServerName" . '.txt';
open(logfilelisting, "$ServerDirectoryFile") or die "Unable to open file: $!";
@CheckForMatchingDate = ;
close(logfilelisting);
foreach (@CheckForMatchingDate) {
$SubOfCheckForMatchingDate = substr($_, 0, 8);
if ($SubOfCheckForMatchingDate eq $TimeStampDate){
$AssignedCorrectLogFile = substr($_, 39);
chomp($AssignedCorrectLogFile);
push(@CorrectLogFiles, "$AssignedCorrectLogFile");
$LogFileFound = "1";
}
}
}