php - Symfony Finder: Finding all directories except ones that start with an underscore -
i want find directories (at root level, not recursive) not start underscore.
getcwd() = /users/example/project
directory example:
/users/example/project/_pictures /users/example/project/_graphics /users/example/project/test
i've tried following code snippet:
$directories = $this->container->get('finder') ->directories() ->in(getcwd()) ->notname('_*') ->depth(0);
but seems return:
/users/example/project/_pictures/home /users/example/project/test
so returns "test", correct, returns sub-folder inside 1 starts underscore, incorrect. ideas what's gone wrong here?
this works:
$directories = glob(getcwd() . '/[!^_]*', glob_onlydir);
but hoped solution using symfony finder.
Comments
Post a Comment