This is the type of thing that scripting languages were created for. I wanted to convert a bunch of .webp files to .jpg using convert and wrote this script in Perl.
#!/usr/bin/perl -w
while(<>){
chomp;
my ($o, $n) = ($_,s/\.webp$/\.jpg/ri);
$cmd= "convert \"$o\" \"$n\"";
print "$cmd\n";
`$cmd`;
}
I can change this around a little bit and make it work to resize files like so...
#!/usr/bin/perl -w
while(<>){
chomp;
my ($o, $n) = ($_,s/.jpg$/-small.jpg/ri);
$cmd= "convert "$o" -resize 1200x900 "$n"";
print "$cmd\n";
$cmd;
}
Run it like this...
$ ls *.jpg | perl resizePictures.pl
Output looks like this...
convert "1639ce10-b1fe-11ed-bdfd-366dddef2df0.jpg" -resize 1200x900 "1639ce10-b1fe-11ed-bdfd-366dddef2df0-small.jpg"
convert "gulf.stream.jpg" -resize 1200x900 "gulf.stream-small.jpg"
convert "main-qimg-2c580245b682a77cb5cf0348f3bbf73c.jpg" -resize 1200x900 "main-qimg-2c580245b682a77cb5cf0348f3bbf73c-small.jpg"
convert "work.jpg" -resize 1200x900 "work-small.jpg"
Golfed at 69 characters
ls *.jpg | perl -ne 'chomp;$n=s/\.jpg$/-small\.jpg/ri;`convert "$_" -resize 1200x900 "$n"`;'