Revision: 6635
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 4, 2008 09:53 by luizlopes
Initial Code
/**
* Function used to delete a folder.
* @param $path full-path to folder
* @return bool result of deletion
*/
function folderDelete($path) {
if (is_dir($path)) {
if (version_compare(PHP_VERSION, '5.0.0') < 0) {
$entries = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) $entries[] = $file;
closedir($handle);
}
}else{
$entries = scandir($path);
if ($entries === false) $entries = array();
}
foreach ($entries as $entry) {
if ($entry != '.' && $entry != '..') {
folderDelete($path.'/'.$entry);
}
}
return rmdir($path);
}else{
return unlink($path);
}
}
Initial URL
Initial Description
This was copied off wordpress FTP plugin
Initial Title
Recursively Remove Folder
Initial Tags
files
Initial Language
PHP