Automating WinRAR?

I have a bunch of folders, each containing two or more files that I need RAR’ed together and named with the folder name (and idealy deleting the leftover files). Any way of automating this?