Adding Folder::rmdir().

Removed empty lines from basics file

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4101 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-12-13 04:39:26 +00:00
parent b5face3516
commit b8a46e14d7
2 changed files with 34 additions and 7 deletions

View file

@ -352,5 +352,32 @@ function slashTerm($path) {
}
return $size;
}
/**
* Recursively Remove directories if system allow.
*
* @param string $path
* @return boolean
*/
function rmdir($path) {
if (substr($path, -1, 1) != "/") {
$path .= "/";
}
foreach (glob($path . "*") as $file) {
if (is_file($file) === true) {
@unlink($file);
}
elseif (is_dir($file) === true) {
if($this->rmdir($file) === false) {
return false;
}
}
}
if (is_dir($path) === true) {
if(rmdir($path) === false) {
return false;
}
}
return true;
}
}
?>