On 10/21/2013 11:55 AM, Herbert König wrote:
Charles,

you're right (I assumed you'd find it once you know it's there :-))

Never had to care about BOM headers, so I didn't know what they are until I looked them up now. But I read UTF8 files all the time.
Entering bom in the search field yields some methods e.g. in UTF8TextConverter, I assume that's why I never ran into it. Seems to 'just work' (TM).

Also there's FileDirectory>>fileNamesMatching: which may help you with your file names matching.

Re generators, make a seperate post for a new topic, people may assume I replied already.

Or try Squeak dev.

Cheers,

Herbert


Am 21.10.2013 19:14, schrieb Charles Hixson:
On 10/21/2013 02:07 AM, Herbert König wrote:
Hi Charles,

No Squeak handy but there is a allfilesinalldirectories. This will give you all files in all subfolders. Tonight I will look up the real name but you may be able to find it in FileStream or similar yourself. 

Cheers
Herbert



-------- Ursprüngliche Nachricht --------
Von: Charles Hixson <charleshixsn@earthlink.net>
Datum: 21.10.2013 9:14 (GMT+01:00)
An: beginners@lists.squeakfoundation.org
Betreff: [Newbies] Walk directory of files?


What is the best way to walk a directory of files?
It would be nice is I could just:
Get next file?
exitst?  ifFalse then done
match pattern?  ifFalse, then go to first step
return file

This requires that the method track where I am.  I think I can figure
out how to stuff them into a collection, and return the entire
collection of matched files, and perhaps that's the right answer, but
that's not the way I would do it in Python or Ruby, so perhaps it's also
not the way to do it in Smalltalk.

Also, if it matters, the files will be utf-8 files, many of them with
BOMs. (Well, not really BOMs, since it's utf8, but the utf8 header.) 
Does Squeak recognize BOM headers?

--
Charles Hixson

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
I think that means I should use
Files-Directories : FileDirectory : fullNamesOfAllFilesInSubtree
and store the collection as I walk through the files processing them rather than use what Python would call a generator.

Do you know whether when reading a utf8 file the BOM is recognized?  Or do I need write a handler to strip it off?
-- 
Charles Hixson


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
If you don't know about generators, and know about file handling, I'll assume that that's not the Squeak idiom.  I can do the same thing with a Collection, I just do things in a slightly different order. 

And thanks for the help.

-- 
Charles Hixson