This should do the job for you.
The de-sorter now creates a folder called "_Cat", makes some more subfolders in that, then shoves all the images in those.
Likewise, the sorter now expects to find images within those catagorised subfolders.
The de-sorter
also now creates two "log" files, a text document telling you which files are missing, and a CSV file that does the same (CSV files can be loaded by Excel and similar). Note that the text log doesn't deal with 0005 files (because I assumed most games wouldn't have them and it'd obfuscate the document) while the CSV file does (because cluttering that doesn't matter).
Both programs now work by copying files (as opposed to moving them).