Copy the codeThe code is as follows:
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:xampphtdocsTNF2');
The above introduces the function code for batch modifying file suffix names in PHP, a special attachment for 1kb folder shortcut virus removal, including the content of a special attachment for 1kb folder shortcut virus removal. I hope it will be helpful to friends who are interested in PHP tutorials. .