Små "enkla" problem när dom är som roligast..
På egen risk..
PHP-kod:
<?php
$wwwroot = "/path/to/wwwroot";
$temp = array();
$list = trim(shell_exec("find $wwwroot -iregex '.*\.\(jpg\|png\|gif\)'"));
if (!empty($list)) {
foreach (explode("\n", $list) as $filepath) {
$oldname = basename($filepath);
if (preg_match("/[A-Z]+/", $oldname)) {
$newname = strtolower($oldname);
if (rename($filepath, dirname($filepath) . "/" . $newname)) {
$temp[$oldname] = $newname;
}
}
}
if (!empty($temp)) {
$list = trim(shell_exec("find $wwwroot -iregex '.*\.\(htm\|html\|css\)'"));
if (!empty($list)) {
foreach (explode("\n", $list) as $filepath) {
file_put_contents($filepath, str_ireplace(array_keys($temp), $temp, file_get_contents($filepath)));
}
}
}
}
?>
Det förutsätts att det är bilderna som har en eller flera versaler medans koden kan ha vad som helst.
För att köra alla bilder kan man ta bort preg_match() {}