There are hundreds of folders, such as idr_web_bkg_png, idr_web_bkg_xml, idr_web_bkg_ico, files, and manually update suffixes one by one. It is too troublesome to use PHP for batch update,CodeAs follows:
$ Dir = ' D: \ Program Files \ resource \ Application \ skin \ PNG \\ ' ; // Note that the path here should be followed by two \ s. The first one indicates conversion, but it is easy to encounter other specific escape characters and must be judged carefully. You can write it as follows:
$ Dir = ' D:/program files/resource/application/skin/PNG/ ' ; // If you write a path like this, you don't have to worry about escape. Last/do not miss writing
If ( $ DH = Opendir ( $ Dir ))
{
While (( $ File = Readdir ( $ DH )) ! = False )
{
If ( $ File ! = " . " && $ File ! = " .. " )
{
If ( Filetype ( $ Dir . $ File ) = ' File ' )
{
$ Newfile = Str_replace ( Array ( ' _ PNG ' , ' _ Xml ' , ' _ ICO ' ) , Array ( ' . PNG ' , ' . Xml ' , ' . ICO ' ) , $ File );
Var_dump ( $ File. ' ======> ' . $ Newfile. ' <Br/>' );
Rename ( $ Dir . $ File , $ Dir . $ Newfile );
}
}
}
Closedir ( $ DH );
}