note 78021 deleted from function.rmdir by ezyang
| From: | ezyang@php.net | Date: | Mon, 24 Sep 2007 23:59:25 +0000 |
| Subject: | note 78021 deleted from function.rmdir by ezyang | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130761@lists.php.net to get a copy of this message | ||
Note Submitter: michael
Reason: useless
----
another simple recursive function deleting a directory
<?
function removeDirRecursive($toDelete)
{
$dir = opendir($toDelete);
while(false !== ($file = readdir($dir)))
{
if(($file != '.') AND ($file != '..'))
{
if(is_dir($toDelete.'/'.$file))
{
removeDirRecursive($toDelete.'/'.$file);
}
if(is_file($toDelete.'/'.$file))
unlink($toDelete.'/'.$file);
}
}
closedir($dir);
rmdir($toDelete);
return true;
}
?>