Automatically moving and sorting recovered files based on file extension

Let’s consider a very complex folder/files structure with a lot of (read infinity) subfolders and a large amount (read infinity again) of files in each subfolder.

This folder structure is generated by PhotoRec, used to recover lost files from damaged/formatted/erased drives.

I needed to move all the files found in those (very numerous) subfolders into different folders based on the file extensions (so in each folder I would only have one filetype, making it a lot easer to browse through and extract important files out of the piles and piles of bulk information).