in reply to Need help with Omitting a directory from this function

Given how that snippet is written, $newdir is in scope within the recursive function, so the function could just treat $newdir as an existing variable that has already been assigned a value.

But your question is unclear, because you don't show how dftree is being called. If you are creating some new directory in the CWD and don't want it to be involved in searches, just get a listing of things to search in the CWD before you create that directory. If there's some pre-existing directory in the CWD that you need to avoid, build a list of things to search in the CWD, remove that one item from the list, and handle the rest of the list.

If you're trying to exclude, say, "foobar" in the CWD, would you still be interested in handling anything called "foobar" at a lower level, or would you rather exclude everything called "foobar" no matter how deeply nested it might be?

  • Comment on Re: Need help with Omitting a directory from this function