move files to matching folders

hi all,
i’m looking fo a script or action which compare the files and folder names in a specific parent folder and move the file inside the matching folder.

ABC.jpg > ABC folder
ABC-001.jpg > ABC folder
abC.html > ABC folder

hope somebody can help me,
unfortunately I’m not clever enough to write a script or automator action.

thanks in advance.