note 30506 deleted from function.rmdir by aidan
| From: | aidan@php.net | Date: | Sun, 05 Sep 2004 07:14:57 +0000 |
| Subject: | note 30506 deleted from function.rmdir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76029@lists.php.net to get a copy of this message | ||
Note Submitter: yuac at doom-3 dot ru
----
Function of removing not empty directory (I know, I know...)
without comments...
function removedir($dir)
{
$dh=opendir($dir);
while ($file=readdir($dh))
{
if($file!="." && $file!="..")
{
$fullpath=$dir."/".$file;
if(!is_dir($fullpath))
{
unlink($fullpath);
}else{
removedir($fullpath);
}
}
}
closedir($dh);
if(rmdir($dir))
{
return true;
}else{
return false;
}
}