isDir()) { $ficheros[]=$file->getpath()."/".$file->getFilename(); } else { $dirs[]=$file->getpath(); } } $dirs=array_unique($dirs); foreach($ficheros as $$file) unlink($file); foreach($dirs as $$file) rmdir($file); ?>