What is the correct way to move folders from one account to another?

I used drag and drop to move an entire folder of messages from my Xfinity email account to my Gmail account.  For some reason, it created empty folders at the destination and deleted all of the messages from the source.  As far as I can tell, those messages are all now permanently deleted.  If this is by design, it’s one of the worst software design choices I’ve ever encountered.  If it’s a bug, is there anything I can do to recover those messages (e.g., a temp folder or cache somewhere)?  Both accounts use IMAP and are supposed to download messages for offline viewing.

As one symptom of something gone wrong, the destination folder correctly indicates the number of unread messages in the “Mail” panel, despite the fact that the folder is actually empty.

A related question is where are the local, offline, copies of my messages stored?

Thanks for any help!