Linux has a handy rename command which is great for easily renaming file extensions within a directory.

> rename .htm .html *.htm

MacOS however has no such command.

Fortunately, Ben Han documented a nice work around by creating a simple script.
(Click here for a reminder on how to create MacOS scripts)

#!/bin/sh
for f in *.$1
do
  mv $f ${f%$1}$2
done

It uses the mv command and loops through your directory doing the move based on whatever parameters you pass in.

For example to change all my pngs to jpgs all I have to do now is navigate to the target directory and type:

> chgext.sh png jpg

And voila! All my pngs are now jpgs.

Thanks again Ben for this great tip.