I'm really new to PERL so forgive me if this is a stupid question. I'm trying to loop through a directory and test each file for two different criteria before I print any file name matching those criteria to a txt file.
The criteria are that it cannot be a directory, and it be older than X number of days. The code I have below will catch the mod date just fine, but it only finds and excludes the first directory it encounters.
foreach (readdir(DIR)) {
$mod = -M "$osapi/$_";
if (!(-d $_)){
if ($mod >= 1) {
print LOG "$osapi/$_\n";
}
}
}
Any help would be greatly appreciated.
Lane
The criteria are that it cannot be a directory, and it be older than X number of days. The code I have below will catch the mod date just fine, but it only finds and excludes the first directory it encounters.
foreach (readdir(DIR)) {
$mod = -M "$osapi/$_";
if (!(-d $_)){
if ($mod >= 1) {
print LOG "$osapi/$_\n";
}
}
}
Any help would be greatly appreciated.
Lane