public static function unlink($path) { if ($handle = opendir($path)) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("{$path}/{$item}")) { Directory::unlink("{$path}/{$item}"); } else { unlink("{$path}/{$item}"); } } } closedir($handle); rmdir($path); } }