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:


And I want:


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: