When migrating public folders from Exchange 2007 or 2010 to Exchange Online there are three methods:

Serial migration method
Batch migration method
Export to PST and import
The serial migration method for migrating public folders is being deprecated and is no longer supported by Microsoft. Exporting to PST and importing is not recommend by Microsoft, with the PST export imports there is no way to manage the PST size limits and auto-spilt and also permissions would have to be setup manually in office 365. This leaves the Batch migration as the only recommended and supported method for migrating legacy public folders to Office 365 and Exchange Online.

Supported Legacy Exchange On-Premises Versions for migrating public folders to Office 365 and Exchange Online

Exchange 2010 SP3 RU8 or later
Exchange 2007 SP3 RU15 or later

Please note: Outlook Anywhere needs to be enabled within Exchange On-Premises Information on how to run the migration and to download the scripts can be found here: https://technet.microsoft.com/en-GB/library/dn874017(v=exchg.150).aspx#PSTMigrate