digitalmars.D - dirEntries with ** (recursive) globbing
- Timothee Cour (13/13) Nov 11 2013 Is there any plan to add recursive globs to dirEntries?
- Jacob Carlborg (6/19) Nov 11 2013 There's an overload of "dirEntries" that takes a path and a pattern. It
- Timothee Cour (7/33) Nov 13 2013 alas, no, I posted on exactly this some times ago:
- Jacob Carlborg (4/7) Nov 13 2013 Hmm, right, my bad.
- timotheecour (3/8) Apr 02 2017 ping on this.
- Timothee Cour (5/42) Nov 13 2013 and this is further compounded by
- Jesse Phillips (3/4) Apr 03 2017 I don't think there is any plan. These have traditionally been
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.
Nov 11 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
Nov 11 2013
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 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
Nov 13 2013
On 2013-11-13 13:20, Timothee Cour 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.comHmm, right, my bad. -- /Jacob Carlborg
Nov 13 2013
On Wednesday, 13 November 2013 at 13:34:37 UTC, Jacob Carlborg wrote:On 2013-11-13 13:20, Timothee Cour wrote:ping on this.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.comHmm, right, my bad.
Apr 02 2017
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 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 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
Nov 13 2013
On Monday, 11 November 2013 at 23:53:26 UTC, Timothee Cour wrote:Is there any plan to add recursive globs to dirEntries?I don't think there is any plan. These have traditionally been shell features, but probably useful in a programming library also.
Apr 03 2017