Ver Mensaje Individual
  #9 (permalink)  
Antiguo 14/09/2008, 23:08
AlvaroX
 
Fecha de Ingreso: septiembre-2008
Mensajes: 242
Antigüedad: 15 años, 8 meses
Puntos: 3
Respuesta: Eliminar archivos subcarpeta

Cita:
Iniciado por Ronruby Ver Mensaje
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?