我正在尝试以这种方式编写批量重命名:
if ($handle = opendir('../../upload_files')) {
while (false !== ($fileName = readdir($handle))) {
$newName = str_replace(", ","_",$fileName);
rename($fileName, $newName);
$count++;
}
closedir($handle);
echo $count." files renamed";
}
但是当我运行脚本时,我收到一个警告:
Warning: rename(..,..) [function.rename]: No error in E:\WEBS\rename.php on line 6
是什么导致了错误?