Update signature of Directory.traverse to allow preorder filtering.