I don’t know what the issue is. Everything is defined with exception of maybe $scanDir? It’s part of a function though so the value of that is passed when it’s called. That shouldn’t be the cause.
for ($a = 0; $a <= count($scanListArrayOrig); $a++) {
rename($scanDir . '/' . $scanListArrayOrig[$a], $scanDir . '/' . $scanListArrayNew[$a]);
}
Replace
<=with<.Demo here: http://ideone.com/yvvAxL