Return to Snippet

Revision: 51940
at October 7, 2011 23:46 by spcmnk


Initial Code
<?php 
 function rrmdir($dir) { 
   if (is_dir($dir)) { 
     $objects = scandir($dir); 
     foreach ($objects as $object) { 
       if ($object != "." && $object != "..") { 
         if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); 
       } 
     } 
     reset($objects); 
     rmdir($dir); 
   } 
 } 
?>

Initial URL

                                

Initial Description

                                

Initial Title
Delete directory and its content recursively

Initial Tags
php, file

Initial Language
PHP