Cita:
Iniciado por Ronruby
Como te dijo Okram. En los comentarios publicados hay varios metodos para borrar directorios y subdirectorios.
Código PHP:
<?php
function rm_recursive($filepath)
{
if (is_dir($filepath) && !is_link($filepath))
{
if ($dh = opendir($filepath))
{
while (($sf = readdir($dh)) !== false)
{
if ($sf == '.' || $sf == '..')
{
continue;
}
if (!rm_recursive($filepath.'/'.$sf))
{
throw new Exception($filepath.'/'.$sf.' could not be deleted.');
}
}
closedir($dh);
}
return rmdir($filepath);
}
return unlink($filepath);
}
?>
vale y ahora como le hago para eliminar la carpeta y archivo si solo cumplen que su fileatime() sea mayor a una fecha dada por un include?