Ensure that builder cleans directory properly.

Prior to this change, only the first item in the directory would be removed
(oops).

Fixes #1118.