Front page | perl.beginners |
Postings from December 2002
Re: Archive Logs
Thread Previous
From:
Rob Dixon
Date:
December 28, 2002 13:18
Subject:
Re: Archive Logs
Message ID:
20021228211800.96815.qmail@onion.perl.org
Erm, is this a trick question Tim? The stuff between your two markers isn't
Perl, it's DOS commands!
If you run it as a batch file it'll throw 'Bad command' errors for each line
beginning with a hash, and then (probably) terminate at the 'exit 0;' line.
The 'tar' command will either throw an error or work, depending on whether
you have a DOS tar utility in your path.
If you give it to Perl, then it will fail in compilation when it comes to
your DOS commands.
It might be nice to see your original Unix version to see where you're
coming from.
Cheers,
Rob
"Tim Martin" <mart9594@bellsouth.net> wrote in message
news:005601c2aead$eb15e0d0$6401a8c0@pc20010107...
> Hi Folks
>
> Need help in getting the code to work in a Win32 perl system.
> I was able to get it to work in a Linux system but not on a Windows 2000
> Server.
> Could you folks please review the code between Archive Logs Report and
> exit 0;
> I just gave up and put in the code that works in a shell script.
>
> Thanks for your help.
> ------------------------------------------------------------------------
> -------
>
> #!/Perl/bin/perl.exe -w
>
> ###################################################
> #
> # This script moves the working file into a
> # archive directory and place a date stamp
> # on the archive files.
> #
> ###################################################
> ###################### Start of Script ######################
> $time_string = time_string();
> ###################### Archive Logs Report ######################
>
> c:
> cd \
> cd \EDS\CLM\Merge_Processing_Area # <-- Source location of
> the files to be archive
> tar -czvf c:\EDS\CLM\Weekly_Archive_Logs\%DATE%.tgz * >>
> c:\CLM\Weekly.log # <-- Location of archive to be placed with date
> stamp and logged.
> cd \
>
> exit 0;
>
> ###################### Time stamp ######################
> # Create timestring for log file
> sub time_string {
> my ($time_string, $sc, $mi, $hr, $dy, $mo, $yr);
>
> ($sc, $mi, $hr, $dy, $mo, $yr) = localtime(time);
> $mo += 1;
> $yr += 1900;
> $time_string = sprintf( "%04d%2d%02d",
> $yr, $mo, $dy );
> return $time_string;
> }
> ###################### End of Script ######################
>
Thread Previous