dirEntries with ** (recursive) globbing

Jacob Carlborg doob at me.com
Mon Nov 11 23:28:30 PST 2013


On 2013-11-12 00:45, Timothee Cour wrote:
> Is there any plan to add recursive globs to dirEntries?
>
> use case:
>
> auto entries=dirEntry("foo/**/bar/*suffix/*.{d,di}", spanMode,
> followSymlink)
> will match for example:
> foo/a/b/bar/somethingsuffix/file.d
>
> Note, ** will match any number (>=0) of directories, whereas a single *
> is non-recursive
>
> (as found in some good shells and IIRC, later versions of python, etc).
>
> note, in this case, spanMode could only be breadth or depth, not shallow
> as the glob fully specifies depth.
>
> I have partially working code (it doesn't handle {} but does handle *
> and **), however it's not the most efficient, so was wondering.

There's an overload of "dirEntries" that takes a path and a pattern. It 
says the pattern is matched using std.path.globMatch. "globMatch" 
matches "*" recursively.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list