Eliminar directorio recursivo con PHP
January 7th, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | < ?php function rmdir_recurse($path) { $path= rtrim($path, '/').'/'; $handle = opendir($path); for (;false !== ($file = readdir($handle));) if($file != "." and $file != ".." ) { $fullpath= $path.$file; if( is_dir($fullpath) ) { rmdir_recurse($fullpath); rmdir($fullpath); } else unlink($fullpath); } closedir($handle); } ?> |