Hello, Ryan & Christopher:

Thanks to you both, for your ideas.

On 04-Oct-01, Ryan Cole wrote:

> Does this do what you need?

> get-sub-files: does [
>     files: copy []
>     foreach item read %. [ if dir? item [append files read item] ]
> ]

Not on its own - I tried it "as is", after getting variable names synced, but
it didn't work. Having said that, I didn't pursue it, to find out >why< it
didn't work for me.

The following is what I ended up using:

 ; get top drawer-list
   drawer-list: READ read-drawer
   cur-files: COPY []
   all-files: COPY [] 

 ; append each directory list into block
   FOREACH drawer drawer-list [
     new-path: JOIN read-drawer drawer
     CHANGE-DIR new-path
     cur-files: READ %.
     all-files: APPEND all-files cur-files
   ]

It reads the top drawer, for that drawer's list of directories, builds a new
path for each sub-directory (there's only one sub level), changes its local
path, then reads each sub-directory, appending its file names into a block.

It's not smart, in the sense that it only deals with directories, but it does
what I need, for now. A file in the top drawer will stop the run, though, so
it most definitely can be improved. Making it into a function may be the next
step, but I'll use it this way, for a while, first.

-- 

                ---===///||| Donald Dalley |||\\\===---
                     The World of AmiBroker Support
                  http://webhome.idirect.com/~ddalley
                          UIN/ICQ#: 65203020

> --Ryan

>      Ryan Cole
>  Programmer Analyst
>  www.iesco-dms.com
>     707-468-5400

> Donald Dalley wrote:

> > Hi, REBOLs:
> >
> > Is there a small, simple method (or function) of getting just the file
names
> > within a set of sub-drawers? I am having trouble efficiently applying what
> > little directory code there is, in the web database.
> >
> > The parent directory has a set of drawers named (-, A, B, C..., 1, 2,
3...),
> > but the code should work universally with any name set. The goal, of
course,
> > is to get only the file names within the drawer set, not the drawer names.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to