From: <jhe...@us...> - 2002-11-20 12:51:29
|
Update of /cvsroot/upcase-project/UpCase/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25639 Modified Files: uc_utils.php Log Message: added recursive directory deletion function Index: uc_utils.php =================================================================== RCS file: /cvsroot/upcase-project/UpCase/lib/uc_utils.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** uc_utils.php 12 Nov 2002 11:11:26 -0000 1.1 --- uc_utils.php 20 Nov 2002 12:51:25 -0000 1.2 *************** *** 65,67 **** --- 65,88 ---- return true; } + + function rrmdir($path) + { + if (is_dir($path)) + { + $handle = opendir($path); + while (false !== ($file = readdir($handle))) + { + if ($file == ".." || $file == ".") + continue; + if (!is_dir($path . "/" . $file)) + unlink($path . "/" . $file); + else + rrmdir($path . "/" . $file); + } + closedir($handle); + rmdir($path); + } + else + return false; + } ?> |