php批量批改文件后缀
                        
                            时间:2021-07-01 10:21:17
                            帮助过:21人阅读
							                        
                     
                    
                    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."
"; 
foreachDir($path.$file); 
}else{ 
echo "--".$path."/".$file."
"; 
$ext = strripos($file,'.'); 
$aaa = substr($file,0,$ext); 
rename($path.'/'.$file,$path.'/'.$aaa.'.JPG'); 
// die(); 
} 
} 
} 
return false; 
} 
} 
foreachDir('D:\xampp\htdocs\TNF2');