[comp.sys.apple2] Searching through directories

bchurch@oucsace.cs.OHIOU.EDU (Bob Church) (10/10/90)

I'm putting together a program in which I need to search through 
directories. The problem is that the number of files is open ended.
A subdirectory can be a mixture of any number of regular files and 
subs. Can anyone help me with a good strategy on this? I don't need
code, just a way of thinking this thing through. Where do you start
and how do you keep track?

bob church
bchurch.oucsace.cs.ohiou.edu

toddpw@tybalt.caltech.edu (Todd P. Whitesel) (10/10/90)

bchurch@oucsace.cs.OHIOU.EDU (Bob Church) writes:

>I'm putting together a program in which I need to search through 
>directories. The problem is that the number of files is open ended.
>A subdirectory can be a mixture of any number of regular files and 
>subs. Can anyone help me with a good strategy on this? I don't need
>code, just a way of thinking this thing through. Where do you start
>and how do you keep track?

You start by calling a routine with the volume directory -- this routine
processes each file in the directory and each time it reaches a subdirectory
it calls itself with the subdirectory. This requires that you save stuff on
the stack, but if you are doing it in a high level language then the stack
manipulation is trivial (it's built into the languages' subroutine calls).

Todd Whitesel
toddpw @ tybalt.caltech.edu