I have a problem with the following block of code. It works fine when
there isn't a *.log file in the same directory as the script  but when
there is, it always returns that log as the newest file and ignores the
list of files it retrieves from the remote server. 

I debugged this and found that the READDIR is working but the last
element in the list is the log file that is in the script directory. 

What can I do to make sure I get the list of *.log files on the remote
machine regardless of what exists in my working local directory?

<snip>

$iisdir = '\\\server01\c$\winnt\system32\logfiles\W3SVC1';
opendir LOGS, "$iisdir" or die "Directory error for IIS LOGS:  $!\n";

my @files = grep /\.log$/, readdir LOGS;
@files = sort { -M $a <=> -M $b } @files;
$active_log = $files[-1];  # this should be the newest file rather than
a log in the local directory that the script is running from.


--Paul

Reply via email to