OK so we have a folder full of scrambled images ending in JPG. I assume they all have, if nothing else, the date the camera gave them within ther EXIF tags, Hence, we are using “exiftool” as is often the case
exiftool ‘-Directory<CreateDate’ -d ./OUT/%Y/%m_%B/%Y.%m.%d -r *.JPG