save files to lowercase in Windows

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
teo74
Posts: 2
Joined: 2013-12-07T13:02:36-07:00
Authentication code: 6789

save files to lowercase in Windows

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: save files to lowercase in Windows

Post by snibgo »

You can rename them:

Code: Select all

ren P1090612.jpg p1090612.jpg
snibgo's IM pages: im.snibgo.com
teo74
Posts: 2
Joined: 2013-12-07T13:02:36-07:00
Authentication code: 6789

Re: save files to lowercase in Windows

Post 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.
visitor x
Posts: 16
Joined: 2013-07-27T13:26:38-07:00
Authentication code: 6789

Re: save files to lowercase in Windows

Post 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")
Post Reply