The semantics of this are fairly confusing. I can understand supplying a directory to use as a stopping point for recursion, but it seems overly complex to accept an arbitrary array. Is there a compelling case to preserve the current behavior?