note 21569 added to function.rmdir

From: Date: Fri, 17 May 2002 16:47:30 +0000
Subject: note 21569 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-30757@lists.php.net to get a copy of this message
Here's a function that removes a whole directory-tree (including files), so be careful with it. function force_rmdirs($dir) { $dh = opendir($dir); while(false !== ($file = readdir($dh))) { if($file != '.' && $file != '..') { $path = $dir.'/'.$file; if(is_dir($path)) force_rmdirs($path); else unlink($path); } } return rmdir($dir); } -- http://www.php.net/manual/en/function.rmdir.php http://master.php.net/manage/user-notes.php?action=edit+21569 http://master.php.net/manage/user-notes.php?action=delete+21569 http://master.php.net/manage/user-notes.php?action=reject+21569

« previous php.notes (#30757) next »