Page 1 of 1

save files to lowercase in Windows

Posted: 2013-12-07T13:13:01-07:00
by teo74
Hi all,
I have the following command:

mogrify -format jpg -path thumbs -thumbnail 200x150 ./1080p/*.jpg

which is: "transform into jpg thumbnails all the jpgs found in 1080p directory and put them into thumbs directory"

Is there a way to save the output files in lowercase?
eg P1090612.JPG to p1090612.jpg

thank you in advance

Re: save files to lowercase in Windows

Posted: 2013-12-07T20:23:35-07:00
by snibgo
You can rename them:

Code: Select all

ren P1090612.jpg p1090612.jpg

Re: save files to lowercase in Windows

Posted: 2013-12-09T12:00:28-07:00
by teo74
thank you, but finally I made it in php:

Code: Select all

$directory="D:/photos/thumbs";

echo '<h3>Scanning folder '.$directory.'</h3>';
$files = scandir($directory);
foreach($files as $key=>$name){
    if ($name[0]!='.'){ // not . or ..
        $oldName = $name;
        $newName = strtolower($name);
        
        echo '<h4>oldName='.$oldName.' -> newName='.$newName;
        
        if ($oldName===$newName) 
            echo ' ->  same'; 
        else {
            rename("$directory/$oldName","$directory/$newName");
            echo ' -> renamed!';
        }
        echo '</h4>';
    }
}
I thought there is some command in ImageMagic to convert to lowercase the output files.

Re: save files to lowercase in Windows

Posted: 2013-12-10T07:03:27-07:00
by visitor x
snibgo wrote:You can rename them:

Code: Select all

ren P1090612.jpg p1090612.jpg
and also in the case of multiple files

Code: Select all

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")