当前位置: 代码迷 >> PHP >> php批量批改文件后缀
  详细解决方案

php批量批改文件后缀

热度:296   发布时间:2012-11-23 22:54:33.0
php批量修改文件后缀
<?php
function foreachDir($path){
$handle=opendir($path);
if($handle){
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!='..'){
if(is_dir($path.$file)){
echo $path.$file."<br/>";
foreachDir($path.$file);
}else{
echo "--".$path."/".$file."<br/>";
$ext = strripos($file,'.');
$aaa = substr($file,0,$ext);
rename($path.'/'.$file,$path.'/'.$aaa.'.JPG');
// die();
}
}
}
return false;
}
}
foreachDir('D:\xampp\htdocs\TNF2');
  相关解决方案