In python I can use glob to search path patterns. This for instance:
import glob
for entry in glob.glob("/usr/*/python*"):
print(entry)
Would print this:
/usr/share/python3
/usr/share/python3-plainbox
/usr/share/python
/usr/share/python-apt
/usr/include/python3.5m
/usr/bin/python3
/usr/bin/python3m
/usr/bin/python2.7
/usr/bin/python
/usr/bin/python3.5
/usr/bin/python3.5m
/usr/bin/python2
/usr/lib/python3
/usr/lib/python2.7
/usr/lib/python3.5
How would I glob
or make a glob equivalent in in D?
------Updated on Sep 12 2017------
I wrote a small D module to do Glob in D: https://github.com/workhorsy/d-glob
None of the answers above worked 100% the same as Glob on Windows and Linux. So I made a small D module that does Glob the right way. Hopefully people find it useful:
https://github.com/workhorsy/d-glob
import std.stdio : stdout;
import glob : glob;
foreach (entry ; glob("/usr/*/python*")) {
stdout.writefln("%s", entry);
}