rendered paste body<?phpheader("Content-type: text/plain;");$log = array();/** * Changes files extensions. * * @param string $path * @param string $old_ext * @param string $new_ext * @param bool $include_sub_dirs */function replace_ext($path, $old_ext, $new_ext, $include_sub_dirs = false){ global $log; foreach (glob($path."*") as $file) { if (is_dir($file)) { if ($include_sub_dirs) { replace_ext($file); } else { continue; } } else { if (substr($file, strrpos($file, '.') + 1) == $old_ext) { $log[] = array('name' => $file, 'newname' => substr($file, 0, strrpos($file, '.')), 'ext' => substr($file, strrpos($file, '.') + 1)); $last_item = $log[count($log)-1]; rename($last_item['name'], $last_item['newname'].'.'.$new_ext); } } }}replace_ext("./", "htm", "html");print_r($log);?>