Thanks for the quick reply! Yes it is used later in the code. Here's what the whole code looks like (please keep in mind I didn't write this :)
my($sec) = 0;
my($min) = 0;
my($hour) = 0;
my($mday) = 0;
my($mon) = 0;
my($year) = 0;
my($sday) = 0;
my($yday) = 0;
my($isdst) = 0;
my($Prefix) = "_*.log";
print "Parsing command string\n";
if ($#ARGV >= 0)
{
if ($#ARGV != 2)
{
print "USAGE\n";
print "perl.exe fwexport.pl 2004 08 31\n";
exit;
}
else
{
$year = $ARGV[0];
$mon = $ARGV[1];
$mday = $ARGV[2];
$DateText = sprintf("%04d\-%02d\-%02d", $year,$mon,$mday);
}
if ($mon == 1)
{
$MonthPreviousText = sprintf("%04d\-%02d", $year-1,$mon+11);
}
else
{
$MonthPreviousText = sprintf("%04d\-%02d", $year,$mon-1);
}
}
else
{
($sec,$min,$hour,$mday,$mon,$year,$sday,$yday,$isdst) = localtime(
+time);
$year = $year + 1900;
$DateText = sprintf("%04d\-%02d\-%02d", $year,$mon+1,$mday-1);
if ($mon == 0)
{
$MonthPreviousText = sprintf("%04d\-%02d", $year-1,$mon+12);
}
else
{
$MonthPreviousText = sprintf("%04d\-%02d", $year,$mon);
}
}
print "checkpoint1\n";
$FolderLocation = "Dir d:\\appdata\\fw1\\R75.20\\fw1\\log\\".$DateText
+.$Prefix;
print $FolderLocation."\n";
#get log file name
$FolderResults = `$FolderLocation`;
#parse the results into a list of shares to query
@FolderResults = split('\n',$FolderResults);
print "checkpoint2\n";
#Loop on each Line
foreach $Line (@FolderResults)
{ print $Line."\n";
if ($Line =~ /$DateText/)
{ #print "****".$Line."\n";
@FileResults = split (' ',$Line);
$ArrayElements = @FileResults;
$FileNameResult = @FileResults[4];
}
}
$FWExport = "fwm logexport -n -a -i d:\\appdata\\fw1\\R75.20\\fw1\\log
+\\".$FileNameResult." -o d:\\appdata\\fw1\\R75.20\\fw1\\log\\export\\
+".$DateText."\.log";
print "FWExport Text: ".$FWExport."\n";
$OutResults = `$FWExport`;
if ($mday == 1)
{
$PKZipLine = "pkzip.exe ".$MonthPreviousText."* ".$MonthPreviousTe
+xt."-01.zip";
print "PKZip Text: ".$PKZipLine."\n\n\n";
}
else
{
print "Skipping zipping and deleting of logs.\n\n\n"
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.