could any one tel me how to create settings to delete all my archived records after ____ months,years etc.that is bsed on conditions?This varies from place to place. For example: one place might want to keep records with us for 6 months and another for 6 years.
Thanks in advance,
Jayachandra
Vijaya KadiyalaPosted Jun 30, 2008, 2:28 PM
Hi Basically what you need to do is scan trhu the each and very file and directory remove the file based on the conditions.
check out the below code to find out the files.
$d = dir($dirName);
$lastModified = 0;
while($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
if (!is_dir($dirName."/".$entry)) {
$currentModified = filemtime($dirName."/".$entry);
} else if ($doRecursive && is_dir($dirName."/".$entry)) {
$currentModified = mostRecentModifiedFileTime($dirName."/".$entry,true);
}
if ($currentModified > $lastModified){
$lastModified = $currentModified;
}
}
}
$d->close();
return $lastModified;
}