note 93836 added to function.rmdir
| From: | kevin at web-power dot co dot uk | Date: | Fri, 02 Oct 2009 12:51:49 +0000 |
| Subject: | note 93836 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161218@lists.php.net to get a copy of this message | ||
I had situation where the rmdir was returning warning message as within last loop it was already
removed. So here is quick fix by adding is_dir to the DelTree routine below
function delTree($dir) {
$files = glob( $dir . '*', GLOB_MARK );
foreach( $files as $file ){
if( substr( $file, -1 ) == '/' )
delTree( $file );
else
unlink( $file );
}
if (is_dir($dir)) rmdir( $dir );
}
----
Server IP: 92.48.74.199
Probable Submitter: 82.24.169.222
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit -- https://master.php.net/note/edit/93836
Del: integrated -- https://master.php.net/note/delete/93836/integrated
Del: useless -- https://master.php.net/note/delete/93836/useless
Del: bad code -- https://master.php.net/note/delete/93836/bad+code
Del: spam -- https://master.php.net/note/delete/93836/spam
Del: non-english -- https://master.php.net/note/delete/93836/non-english
Del: in docs -- https://master.php.net/note/delete/93836/in+docs
Del: other reasons-- https://master.php.net/note/delete/93836
Reject -- https://master.php.net/note/reject/93836
Search -- https://master.php.net/manage/user-notes.php