"."&&$file<>".."&&$file<>"rename.php"){ // first, change ampersands to and, remove spaces and replace with underscores, then lowercase the whole thing. $newfile=strtolower(str_replace(" ", "_", str_replace("&", "and", $file))); $downloadinfo=".pdf, ".round(filesize($file)/1024)."k"; rename($current_dir.$file, $current_dir.$newfile); $e++; echo"
".str_replace(".pdf", "", $file)." $downloadinfo
\r\n"; } } echo "