Take a look at this macro. It should do the job, and help you understand how to use the above two Actions I posted.
The key Action here is the For Each Action, which processes each file in the Source folder. Please feel free to ask any follow-up questions about the macro or the logic used.
Be sure to first test using a small number of files in the Source folder.
##Macro Library Create Folders from Files
####Download:
Create Folders from Files.kmmacros (30 KB)