Revision: 23666
Updated Code
at February 10, 2010 17:47 by xida
Updated Code
/*! \brief delete old file in a directory
* does not delete files in subdirectories
* \version 1.0
*/
$path = 'includes/tmp/';
//age in seconds
$ageallowed = "1";
$directory = opendir($path);
while($item = readdir($directory)){
if(($item != ".") && ($item != "..")) {
if(is_file($path . $item)) {
if((time() - getlastmod($path . $item)) > $ageallowed) {
unlink($path . $item);
}
}
}
}
Revision: 23665
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 10, 2010 17:47 by xida
Initial Code
/*! \brief delete old file in a directory
* does not delete files in subdirectories
* \version 1.0
*/
$path = 'includes/tmp/';
$ageallowed = "1";
$directory = opendir($path);
while($item = readdir($directory)){
if(($item != ".") && ($item != "..")) {
if(is_file($path . $item)) {
if((time() - getlastmod($path . $item)) > $ageallowed) {
unlink($path . $item);
}
}
}
}
Initial URL
Initial Description
Initial Title
delete old files
Initial Tags
Initial Language
PHP