Move files to Folders with Names found in Files

I have many files in a folder that I want to quickly (and regularly) sort into a lot of folders. Each file has the name of the folder that I want the file to go to as the first part of the file till it reaches the character "-" (or dash). Below is the example of the files that I have:
Directory: AAA_AA
File 1: AAA_AA-12-31-2022.txt
File 2: BBB_BB-12-31-2022.txt
When finished, I should have 2 directories: AAA_AA and BBB_BB and the first file should be moved into AAA_AAA and the second file should be moved to BBB_BB.
Can you help?
Directory: AAA_AA
File 1: AAA_AA-12-31-2022.txt
File 2: BBB_BB-12-31-2022.txt
When finished, I should have 2 directories: AAA_AA and BBB_BB and the first file should be moved into AAA_AAA and the second file should be moved to BBB_BB.
Can you help?