Moving files from one folder structure to another

I have a series of folders containing pdfs and docs in the following folder structure:

Smith
—Job 1
-------pdf (containing pdfs)
-------doc (containing docs files)
—Job 2
-------pdf (containing pdfs)
-------doc (containing docs files)
—Job 3
-------pdf (containing pdfs)
-------doc (containing docs files)

I would like to change so the pdfs and docs are moved to the following folder structure

Smith
—pdf
------job 1 (all the pdfs contained in Smith / Job 1 / pdf)
------job 2 (all the pdfs contained in Smith / Job 2 / pdf)
------job 3 (all the pdfs contained in Smith / Job 3 / pdf)
—doc
------job 1 (all the pdfs contained in Smith / Job 1 / doc)
------job 2 (all the pdfs contained in Smith / Job 2 / doc)
------job 3 (all the pdfs contained in Smith / Job 3 / doc)

Is it possible to do with a Keyboard Maestro macro? I have a number of folders to re-organise and will take a lot of time to do manually. Any help would be very gratefully received.

This is a fairly complicated task. While it might be possible to do using native KM Actions, most likely it would be best to use a script (AppleScript, JXA).

Before you make this structural change, may I ask, what is your end objective for doing so?

If it is to easily find/see all of the files with a specific type (extension) for a specific person, then a simple search can do that for you:

###Bash Shell Script

find ~/Documents/TEST/Jobs/Smith -name *.docx

Put into a KM Macro,

this would return:

You could also to a simple search in the Finder:

Is this a solution you would be interested in?
If so, it could be enhanced to allow you to open a selected file.