Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #5467

Re: Using results of a directory cataloguing

From Martin <News03@avisoft.f9.co.uk>
Subject Re: Using results of a directory cataloguing
Newsgroups comp.sys.acorn.programmer
Date 2018-06-12 13:34 +0100
Message-ID <5706ff87b4News03@avisoft.f9.co.uk> (permalink)
References <2b768c7d-683e-4ccd-bb16-dae46badf4a6@googlegroups.com> <acecd7c9-5270-44b5-89d2-4d86775aff68@googlegroups.com>
Organization None

Show all headers | View raw


On 12 Jun in article
<acecd7c9-5270-44b5-89d2-4d86775aff68@googlegroups.com>,
   <jgh@mdfs.net> wrote:
> It's risky to demand all the filenames in a directory all at once
> (on any system) as you don't know beforehand how many you'll get,
> so could potentially fetch four billion filenames. It's best to
> get them one at a time and do whatever processing you want to do
> on each one as you go.

Asking for *all* the files is obviously not a good thing to do, 
but asking for a number with limits is fine.

> The following is portable across any platform with an Acorn/BBC API:
> http://beebwiki.mdfs.net/Scanning_Directories_(Reading_Directory_Entries)

On a BBC computer, using CALL &FFD1 to call the old BBC MOS style
OSGBPB routine would be the (only) way to go. However, the OP is
using RISC OS v3.1, and I would suggest the new-style SYS "OS_GBPB"
would be much better even though CALL &FFD1 may still work.

Using SYS "OS_GBPB" with r0=9 to 12, you can decide how much
information you want to be returned for each file, and the maximum
number of files to be returned in one call. They may both depend on
on the buffer size that you can make available. The more files at
once, the faster it will be ... but does make the program slightly
more complex.

In BASIC the simple code is based on...
  max%  = ???   :REM max files that might be returned 
  blen% = ???   :REM to hold approx max% entries
  DIM buf% blen%
  next% = 0
  REPEAT
    SYS "OS_GBPB",xx,dir$,buf%,max%,next%,blen%,name$ TO,,,read%,next%
    IF read% <> 0 THEN 
        process buffer
    ENDIF
  UNTIL next% = -1

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Using results of a directory cataloguing xltardy@gmail.com - 2018-06-10 20:13 -0700
  Re: Using results of a directory cataloguing "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-06-11 08:38 +0100
    Re: Using results of a directory cataloguing Alan Adams <alan@adamshome.org.uk> - 2018-06-11 10:20 +0100
  Re: Using results of a directory cataloguing jgh@mdfs.net - 2018-06-12 02:55 -0700
    Re: Using results of a directory cataloguing Martin <News03@avisoft.f9.co.uk> - 2018-06-12 13:34 +0100
    Re: Using results of a directory cataloguing druck <news@druck.org.uk> - 2018-06-12 18:25 +0100
      Re: Using results of a directory cataloguing xltardy@gmail.com - 2018-06-15 21:04 -0700
      Re: Using results of a directory cataloguing xltardy@gmail.com - 2018-06-15 21:20 -0700

csiph-web