分类:
2009-01-09 08:26:05
<?php
/**
*
* @filename template.php
* @version 0.0.1
* @author Mirror.Wu
* @update 2008-7-12
* @comment XXXXXXXXXXXXX
*/
$test_path = '/web/newg';
function rename_dir($path,$logfile)
{
$files = scandir($path);
// unset($files[0]);
// unset($files[1]);
foreach ($files as $key => $value)
{
if ($value != '.' && $value != '..')
{
$old_path = $path . '/' . $value;
$upper_value = strtoupper($value);
$new_path = $path . '/' . $upper_value;
rename($old_path, $new_path);
$inf = $new_path."\r\n";
fwrite($logfile, $inf);
echo $inf;
if (!is_file($new_path))
{
rename_dir($new_path,$logfile);
}
}
}
}
$handle = fopen('/web/log.txt', 'a+');
rename_dir($test_path,$handle);
fclose($handle);