How to show all files under a document and rename the file names?

$dirname=”E:/zhanzhongjie/chengbiao-com/chengbiao-com”;
$dir_handle=opendir($dirname);
while($file=readdir($dir_handle))

{
echo $file.”
“;
rename(“E:/zhanzhongjie/chengbiao-com/chengbiao-com/”. $file, “E:/zhanzhongjie/chengbiao-com/chengbiao-new/insurance-“.$file);
}

closedir($dir_handle)

——

We also can upload the code the web space, and rename the file names online:

$dirname=”/home/wanghong/public_html/chengbiao”;
$dir_handle=opendir($dirname);
while($file=readdir($dir_handle))

{
echo $file.”
“;
rename(“/home/money/public_html/chengbiao/”. $file, “/home/money/public_html/chengbiao-new/insurance-“.$file);

}

closedir($dir_handle)

remember to del chengbiao and rename chengbiao-new back to chengbiao.