Can I bulk move local messages and folders to a server?
Informational post.

So … I've been reading up on the IMAP protocol. It seems to me that IMAP doesn't really have a formal concept of subfolders. If you want to name one mailbox "House" and another one "House.Plumbing", that's entirely up to you. It just happens that Mail.app, and probably many other email clients choose to present these folders to you in a hierarchical form.

That also explains why I encountered some higher-level folders that wouldn't accept any messages — if you were to create, e.g. "House.Plumbing" but not "House", Mail.app would show you the un-writable virtual folder "House" with the subfolder "Plumbing". But as far as the IMAP server is concerned, it's just a folder named "House.Plumbing".

(This isn't to say that the IMAP server itself won't store the folders in a hierarchical way, but the standard doesn't say either way, AFAIK.)