Revert "Rewrite clean function since it was misbehaving and deleting files in an ignored directory."

This reverts commit c0d24ecc32c9f2a7ee852288454020ee3b88b037.
Create a copy of directory list for iteration.