Jump to content
php.lv forumi

failu dzeeshana


neo

Recommended Posts

Deletes a directory and all subdirectories and their contents.

<?
function DELETE_RECURSIVE_DIRS($dirname) 
{ // recursive function to delete 
 // all subdirectories and contents: 
 if(is_dir($dirname))$dir_handle=opendir($dirname); 
 while($file=readdir($dir_handle)) 
 { 
   if($file!="." && $file!="..") 
   { 
     if(!is_dir($dirname."/".$file))unlink ($dirname."/".$file); 
     else DELETE_RECURSIVE_DIRS($dirname."/".$file); 
   } 
 } 
 closedir($dir_handle); 
 rmdir($dirname); 
 return true; 
} 
?>

http://codewalkers.com/seecode/436.html

Link to comment
Share on other sites

×
×
  • Create New...