note 95444 added to function.rmdir
| From: | jacek at jacekk dot co dot uk | Date: | Mon, 04 Jan 2010 01:49:49 +0000 |
| Subject: | note 95444 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164578@lists.php.net to get a copy of this message | ||
I don't think and of the recursive function here actually work so here is my one that does...
<?php
function rmrf($path){
$files = scandir($path);
foreach($files as $file){
if ($file !== '.' && $file !== '..'){
if(is_dir($path.'/'.$file)){
if (count(glob($path.'/'.$file.'/*')) > 0){
rmrf($path.'/'.$file);
}else{
rmdir($path.'/'.$file);
}
}else{
unlink($path.'/'.$file);
}
}
}
rmdir($path);
}
?>
----
Server IP: 87.124.86.46
Probable Submitter: 188.220.133.216 (proxied: 188.220.133.216)
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit -- https://master.php.net/note/edit/95444
Del: integrated -- https://master.php.net/note/delete/95444/integrated
Del: useless -- https://master.php.net/note/delete/95444/useless
Del: bad code -- https://master.php.net/note/delete/95444/bad+code
Del: spam -- https://master.php.net/note/delete/95444/spam
Del: non-english -- https://master.php.net/note/delete/95444/non-english
Del: in docs -- https://master.php.net/note/delete/95444/in+docs
Del: other reasons-- https://master.php.net/note/delete/95444
Reject -- https://master.php.net/note/reject/95444
Search -- https://master.php.net/manage/user-notes.php