Borra una carpeta y todos sus archivos


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function borrarTodo($raiz){
  2. if($objs = glob($raiz."/*")){
  3. foreach($objs as $obj) {
  4. is_dir($obj)? borrarTodo($obj) : unlink($obj);
  5. }
  6. }
  7. rmdir($raiz);
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.