Restore backups of your folders from before when you did this. Of course, this will mean that the current Lightroom Classic catalog will not be able to find the photos. So you will also need to restore a backup of the Lightroom Classic catalog file from before this happened. Or maybe you are so new at Lightroom Classic that starting over completely with a brand new catalog and the photos back in their folders by subject, might make sense.
How could this happen?
Seems like user error, or user just went ahead and did things without understanding what they were doing. Please spend some time and read or view beginner material on how Lightroom Classic works, such as the free beginner's e-book at lightroomqueen.com