How to rebuild current email client database

Im running version 8.1979 and quite happy with it. However, I migrated from POP to IMAP, and I have jumble of mixed up mail I wish to clean up and condense. What is the best way to do this so that I can start fresh, yet migrate specific date ranges/ current folds of emails I currently have to new one? The total file is about 3.3gig on backup. I have too many folders and subfolders.