note 75691 added to function.rmdir
| From: | ljubiccicaatyahoodotcom at osu1 dot php dot net | Date: | Tue, 12 Jun 2007 05:06:14 +0000 |
| Subject: | note 75691 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127410@lists.php.net to get a copy of this message | ||
Note to babca's improvement (of function from "brousky - gmail"):
I think you forgot to call your function with a new name?
(if (!rmdir_rf($file)) return false; -> if (!full_rmdir($file)) return false;)
<?
function full_rmdir($dirname){
if ($dirHandle = opendir($dirname)){
$old_cwd = getcwd();
chdir($dirname);
while ($file = readdir($dirHandle)){
if ($file == '.' || $file == '..') continue;
if (is_dir($file)){
if (!full_rmdir($file)) return false;
}else{
if (!unlink($file)) return false;
}
}
closedir($dirHandle);
chdir($old_cwd);
if (!rmdir($dirname)) return false;
return true;
}else{
return false;
}
}
?>
Nice function thou...
=)
----
Server IP: 213.250.2.28
Probable Submitter: 193.95.242.126
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit -- https://master.php.net/note/edit/75691
Del: integrated -- https://master.php.net/note/delete/75691/integrated
Del: useless -- https://master.php.net/note/delete/75691/useless
Del: bad code -- https://master.php.net/note/delete/75691/bad+code
Del: spam -- https://master.php.net/note/delete/75691/spam
Del: non-english -- https://master.php.net/note/delete/75691/non-english
Del: in docs -- https://master.php.net/note/delete/75691/in+docs
Del: other reasons-- https://master.php.net/note/delete/75691
Reject -- https://master.php.net/note/reject/75691
Search -- https://master.php.net/manage/user-notes.php