I'm trying to change every file name in a folder, for e.g if file name is style.css than i want to rename it as style_[md5 value of style].css
= style_a1b01e734b573fca08eb1a65e6df9a38.css
here is what I've tried
if ($handle = opendir("D:/web/htdocs/extra/css/")) {
while (false !== ($fileName = readdir($handle))) {
$path_parts = pathinfo($fileName);
$newName = md5($path_parts['filename']);
rename($fileName, $newName);
}
closedir($handle);
}
Where am i wrong?
errors are
Access is denied. (code: 5)
The system cannot find the file specified. (code: 2)