I have a tons of files in a directory that has underscore in their names, and I need to rename them by replacing underscore to dash.
I wrote this script in PHP and it worked!
<?php
$dir = getcwd();
$files = scandir($dir);
foreach ($files as $key => $value){
if (!in_array($value, array(".",".."))){
echo "Renaming " . $value . "<br>";
rename($value, str_replace("JPG", "jpg", $value));
}
}