This seems pretty inefficient to me. We are already recursively walking the directory structure, why do we have to do it again at each directory?