note 30506 added to function.rmdir

From: Date: Thu, 20 Mar 2003 16:40:59 +0000
Subject: note 30506 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-45559@lists.php.net to get a copy of this message
Function of removing not empty directory (I know, I know...) without comments... function removedir($dir) { $dh=opendir($dir); while ($file=readdir($dh)) { if($file!="." && $file!="..") { $fullpath=$dir."/".$file; if(!is_dir($fullpath)) { unlink($fullpath); }else{ removedir($fullpath); } } } closedir($dh); if(rmdir($dir)) { return true; }else{ return false; } } -- http://www.php.net/manual/en/function.rmdir.php http://master.php.net/manage/user-notes.php?action=edit+30506 http://master.php.net/manage/user-notes.php?action=delete+30506 http://master.php.net/manage/user-notes.php?action=reject+30506

« previous php.notes (#45559) next »