Directory enumeration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Directory enumeration

Stephen-71
Better give you the version and here is the code I'm using.


Version: Linux
gst -v   -> GNU Smalltalk version 2.3.6


Code sample
------------
#! /usr/local/bin/gst  -f


Object subclass: #DirNav
         instanceVariableNames: ''
         classVariableNames: ''
         poolDictionaries: ''
         category: 'SG-Scripting'!

!DirNav methodsFor: 'operation'!

enum_folders: dirname
    | homedir |
    (File exists: dirname)
       ifTrue:  [
            homedir := Directory name: dirname.
            homedir allFilesMatching: '*' do: [ :file |
            Transcript showCr: file name.
       ]    ]
    ! !

Smalltalk at: #dirnav put: (DirNav new) !
dirnav init !
dirnav enum_folders: '/home/stephenw/projects_smalltalk' !




Thanks
Stephen



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk