First it is no problem to run a macro on all files in a directory structure. Use the macro I have posted at
Run Macro on all files within folder. You just have to replace the first line of the macro to:
FindInFiles
Recursive "
directory" "
*.*" ""
My macro and your macro must be stored in the same macro file.
Second copying all files of a directory structure to one directory is an easy job when using the branch view of
Total Commander. But in general following works with Windows Explorer as well as with Total Commander:
Open the root directory of the files in your file manager.
Open the File Search dialog, enter *.* as search criteria and run the search.
You have now a complete list of files in the entire directory structure.
Press Ctrl+A to select all files and while holding the left Ctrl key click on every directory name in the list. You want to copy only the files, not the directories.
Next open a second instance of your file manager (Windows Explorer) and open the target directory in this instance.
Switch back to the search result with all files already selected.
Click with left mouse button on one of the selected files and hold the mouse button.
Drag the mouse pointer over the window of the second instance of your file manager over the free space of the target directory.
Press the left Ctrl key and hold it. The mouse pointer will change and has now a small + symbol. This is important because that means the files are copied and not moved.
While still holding left Ctrl key leave the left mouse button now with the mouse pointer over the target directory window.
Your file manager copies now all the files. Hopefully all your files have a unique file name.