which version of processing do you use?
seems like you're missing an import
I'm tweaking up the code so I'll give you a better version where you can do multiple files, in a few hours when it's done :)