replacing the variables with your particular situation. It can take a very long time to run. If you want to test that it works reasonably well for your situation, you can find a folder that is small and run the script on that folder (in my case, that's the inbox). Uncomment the line with 'INBOX' below (and change folder to a smaller one if your inbox is big).