[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] walking a directory tree

From: Sean Allen
Subject: Re: [Help-smalltalk] walking a directory tree
Date: Fri, 9 Jan 2009 01:59:44 -0500

On Jan 9, 2009, at 1:16 AM, Paolo Bonzini wrote:

Sean Allen wrote:
i did see anything like this but, before i go ahead and code it,
i thought i would check to make sure i didn't miss anything.

is there a method to enumerate through all entries in a directory,
all the way down.. ( not just the top level in a directory )


 (File name: 'foo') allFilesMatching: aPattern do: aBlock

the "aPattern" has to be in the same syntax as String>>#match:, so ? is
replaced by # and * works as in the shell.

Or you can use #all the same as I was suggesting for chown:

i have to admit, i either missed that or it didnt stick in my head.

 (File name: 'foo') all do: [ :file | ]
 (File name: 'foo') all namesDo: [ :string | ]
 (File name: 'foo') all filesMatching: aPattern do: aBlock
 (File name: 'foo') all namesMatching: aPattern do: aBlock

I'm experiencing some weirdness with this...

this works:
file :=  File name: '/Users/Spooneybarger'
file all do: [ :e | e isDirectory ifTrue: [ e name printNl ]  ]

if i do:
file :=  File name: '/Users/Spooneybarger'
file all do: [ :e | e isDirectory ifTrue: [ e directories printNl ]  ]

i get no output other than: "Global garbage collection... done, heap grown"
over and over and over

yet a boring old

file directories printNl

works fine.

i'm really just playing around right now. shouldnt i get output from the

ifTrue: [ e directories printNl ]

does the fact that I'm not mean that I have a messed up build?

Thanks for your work again, every stumbling of yours will
make GST a better product for others to learn.

I would call my stumblings work, but you are welcome nonetheless.
Thank you for the assistance in getting me up and runing.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]