dirEntries with ** (recursive) globbing

Timothee Cour thelastmammoth at gmail.com
Wed Nov 13 04:26:05 PST 2013


and this is further compounded by
http://d.puremagic.com/issues/show_bug.cgi?id=11501 : dirEntries fails with
"Failed to stat file" when encountering broken symlinks which i posted
couple days ago


On Wed, Nov 13, 2013 at 4:20 AM, Timothee Cour <thelastmammoth at gmail.com>wrote:

> alas, no, I posted on exactly this some times ago:
> glob is non-recursive in D:
>
> http://forum.dlang.org/post/mailman.2367.1382320537.1719.digitalmars-d-learn@puremagic.com
>
> Furthermore, it would be very inefficient to filter out results given by
> recursive dirEntries that match a glob pattern in general case (I can give
> examples if needed)
>
>
>
>
> On Mon, Nov 11, 2013 at 11:28 PM, Jacob Carlborg <doob at me.com> wrote:
>
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131113/182a37d1/attachment.html>


More information about the Digitalmars-d mailing list