note 21569 deleted from function.rmdir by spic

From: Date: Tue, 17 Sep 2002 11:16:16 +0000
Subject: note 21569 deleted from function.rmdir by spic
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-36827@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); }

« previous php.notes (#36827) next »