Move certain files while retaining folder structure

I have a load of deep directories containing a mixture of file types. I want to separate out the files by type, but retaining the directory structure.

So for example I have:

web/site1/index.html
web/site1/image.jpg
web/site2/index.html
web/site2/image.jpg

And I want:

html/site1/index.html
html/site2/index.html
images/site1/image.jpg
images/site2/image.jpg

I found this ancient thread: Copy/Move specific files to an identical folder structure

Is there a better way to do this 13 years later? I've got about 2.7TB of files so I'd prefer to rename (move) them rather than copy and delete them.

It's a 10 minute job in C# but I thought Opus might be able to do it.

That should be fairly easy with a rename script. Just have the script code look at the extension and choose a folder to move (rename) the files into.

If you want help writing the script, please give a full specification of what you want it to do, including all the different extensions and directories they should go in, and an example before & after list of paths.

Possibly this script might already do what you want (or not need much modification):

Thanks. I thought about adapting that script, but in the end just wrote this: https://github.com/kuro68k/FileSieve