0) { echo($e); return($e); } else { if($i>1) { return($outpath); } else { return($outpath . "/" . $zname); } } } // recursively remove directory (ie. directory and any file and subdirectory contents) function rmdirr($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir."/".$object) == "dir") rmdirr($dir."/".$object); else unlink($dir."/".$object); } } reset($objects); rmdir($dir); } } // recursively create a directory (i.e. creates any parent tree if not existing) function mkdirr($pn,$mode=null) { if(is_dir($pn)||empty($pn)) return true; $pn=str_replace(array('/', ''),DIRECTORY_SEPARATOR,$pn); if(is_file($pn)) {trigger_error('mkdirr() File exists', E_USER_WARNING);return false;} $next_pathname=substr($pn,0,strrpos($pn,DIRECTORY_SEPARATOR)); if(mkdirr($next_pathname,$mode)) {if(!file_exists($pn)) {return mkdir($pn,$mode);} } return false; } function findwebfile($path) { $filename = ""; if (is_dir($path)) { $objects = scandir($path); foreach ($objects as $object) { if(substr($object,-5)==".html") { if ($filename!="") { if(substr($filename,-7,1)=="_") $filename = $object; } else { $filename = $object; } } } reset($objects); } return $filename; } ?>