I've found this thread which seems to describe the same issue
http://forums.androidcentral.com/htc-one-m8/416158-folders-disappeared-gallery.html
Clearing the cache and disabling and enabling the apps hasn't fixed it for me though, I'm still in exactly the same position. New photos will save...