hi Rolf nochma,
Die Funktion stat liefert dazu einiges:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
3 nlink number of (hard) links to the file
4 uid numeric user ID of file's owner
5 gid numeric group ID of file's owner
6 rdev the device identifier (special files only)
7 size total size of file, in bytes
8 atime last access time since the epoch
9 mtime last modify time since the epoch
10 ctime inode change time (NOT creation time!) since the
ich habs mal so probiert,
opendir(DIR,"/home/www/");
my @eintrags = readdir(DIR);
closedir(DIR);
my $jetzt = time();
my $bis = $jetzt - 7200; #jetzt minus 2stunden(zahl in sekunden)
foreach (@eintrags) {
if ((-f $_) and ((stat($_))[9]) < $bis){ #wenn älter als 2 stunden
print "folgende daten $_ sind älter als 2 stunden\n";
#unlink ("$_"); oder lösche die alten daten
}
}
ist das so ok oder gehts einfacher?
Grüsse
Alain
P.S.lieber 2 stunden aktualisieren,weil 1 tag ist ja schon alt :)