GrahamBright
Programmer
Hi,
I'm trying to find the latest file in a directory, but am not sure of the syntax for the -A file test
sub latestFile(){
my $BASE = "/apps/omgfs/application/1410_1480/deploy/log/";
opendir(DIR,"$BASE") or die " cannot opendir $BASE : $!";
while (defined($file = readdir(DIR))) {
if ( -A $file ) ???
{
print "$file \n" #print only latest file
}
}
closedir(DIR);
I'm trying to find the latest file in a directory, but am not sure of the syntax for the -A file test
sub latestFile(){
my $BASE = "/apps/omgfs/application/1410_1480/deploy/log/";
opendir(DIR,"$BASE") or die " cannot opendir $BASE : $!";
while (defined($file = readdir(DIR))) {
if ( -A $file ) ???
{
print "$file \n" #print only latest file
}
}
closedir(DIR);