Hello Ashley,

the problem lies in the long file name - OR -
the problem lies in the program gzip - OR -
the problem lies in DOS which lives in WINXXX

You want to run a command (gzip)
with a file name as argument, not in 8.3 notation,
which doesn't support long file names. So all the 3 reasons mix up here.

--->  Try it with the short file name. (There must be a function which does
this, but I can't find the name right now...)

HTH
Stefan



|--------+--------------------------------->
|        |          "Robjohns, Ashley -    |
|        |          COMPAQ"                |
|        |          <[EMAIL PROTECTED]|
|        |          lding.com>             |
|        |                                 |
|        |          16.02.01 05:44         |
|        |                                 |
|--------+--------------------------------->
  >------------------------------------------------------------------------|
  |                                                                        |
  |       An:     "'[EMAIL PROTECTED]'"            |
  |       <[EMAIL PROTECTED]>,                     |
  |       "'[EMAIL PROTECTED]'"                    |
  |       <[EMAIL PROTECTED]>,                     |
  |       "'[EMAIL PROTECTED]'"                          |
  |       <[EMAIL PROTECTED]>                            |
  |       Kopie:  (Blindkopie: Stefan Albert/sdv)                          |
  |       Thema:  Eventlog script - fails with No such file or directory   |
  >------------------------------------------------------------------------|





Hello all,

Could someone please explain to me, why the following fails when processing
the Application log, with the error
"c:/EventLogs/2001_02_16_Application.events: No such file or directory", but
when I uncomment the printf statement it works fine?

The error is displayed by the gzip command.

I discovered the printf statement fixed the problem, when trying to
determine whether the value of $filename was valid.


Kind Regards,

Ashley Robjohns


############################
#!/usr/bin/perl
use Win32::EventLog;
use Time::CTime;
use strict;
my $VERSION = '1.00';

my ($Event, @timearray, $filename,
    $day, $month, $directory);

#  Location to store the backup files?
$directory = 'c:/EventLogs/';

for ('System', 'Security', 'Application')     {
     $Event = new Win32::EventLog ("$_", "");
     @timearray=localtime(time);
     $month = sprintf ('%.2d', $timearray[4] +1);
     $day = sprintf ('%.2d', $timearray[3]);
     $filename = $directory . ($timearray[5]+1900) . '_' .
                  $month . '_' . $day . '_' . $_ . '.events';
     $Event->Clear($filename);
#    printf ("$filename\n");
     `gzip -9 $filename`;
} # End for
############################

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl



_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to