Thread overview
std.file
Apr 11, 2012
Russel Winder
Apr 11, 2012
Russel Winder
April 11, 2012
I am hoping I am failing to see the entry in the documentation due to...

Python, Java and Groovy (at least, probably other languages) have functions for iterating over directory hierarchies, i.e. tree walkers / visitors.  For example in Python:

	for root , directories , files in os.walk ( '.' ) :
		doStuff ( files )

I can see in std.file the tools needed to do this by hand, but I would have thought in this day and age such a function should be in the standard library.  Thus I am hoping I am just missing it...

Thanks.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


April 11, 2012
On 4/11/12 9:07 AM, Russel Winder wrote:
> I am hoping I am failing to see the entry in the documentation due to...
>
> Python, Java and Groovy (at least, probably other languages) have
> functions for iterating over directory hierarchies, i.e. tree walkers /
> visitors.  For example in Python:
>
> 	for root , directories , files in os.walk ( '.' ) :
> 		doStuff ( files )
>
> I can see in std.file the tools needed to do this by hand, but I would
> have thought in this day and age such a function should be in the
> standard library.  Thus I am hoping I am just missing it...

http://dlang.org/phobos/std_file.html#dirEntries

Andrei


April 11, 2012
Andrei,

On Wed, 2012-04-11 at 09:15 -0500, Andrei Alexandrescu wrote: [...]
> 
> http://dlang.org/phobos/std_file.html#dirEntries
> 

Aha, I missed the SpanMode parameter and thought this function only dealt with the current directory without descending.  (Note to self: must *read* the manual instead of just skimming it.)

Thanks.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder