Hi All,

I've got a couple of problems with checking backup log files generated by
windows 2003 server ntbackup. First and biggest problem is that
backup[01-10].log files are unicode and when I open them and check for
different strings I get no matches as it opens them in unicode and not
ascii. I've searched everywhere for unicode to ascii conversion but can't
find anything. Is there a simple way to open or convert the log file as
ascii so I can do what I need to do? Here's the code I'm using to open the
file:

open(LOG,"<$backup_log_absol");
flock(LOG, 2);
my (@backlog) = <LOG>;
close (LOG);

Pretty standard but useless!!

Secondly, although not really a problem, is there any way I can condense the
following code:

opendir DIR, $log_dir or die "Error reading $log_dir: $!n";
my @sorted = sort {-M "$log_dir/$b" <=> -M "$log_dir/$a"}
readdir(DIR);
closedir DIR;
my(@logfiles);
foreach (@sorted) {
 unless (($_ eq ".") or ($_ eq "..") or ($_ eq "fred.bks")) {
  push @logfiles, "$_";
 }
}
my $newestfile = $logfiles[-1];

As you can see I'm opening the ntbackup log file directory away in docs &
settings to find the newest file thats not ".", ".." or "fred.bks". It seems
dirty code to me and I'm sure it could be written better.

Thanks in advance for any help,

Ewen

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to