note 46930 deleted from function.rmdir by aidan
| From: | aidan@php.net | Date: | Tue, 15 Feb 2005 03:43:46 +0000 |
| Subject: | note 46930 deleted from function.rmdir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85044@lists.php.net to get a copy of this message | ||
Note Submitter: agotterer at email dot com
----
Heres a way to remove the directory, and all sub content.
function deldir($dir) {
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
if(rmdir($dir)) {
return true;
} else {
return false;
}
}