Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Tue, 12 Jun 2018 07:37:22 -0500 From: Martin Subject: Re: Using results of a directory cataloguing Newsgroups: comp.sys.acorn.programmer Date: Tue, 12 Jun 2018 13:34:04 +0100 Message-ID: <5706ff87b4News03@avisoft.f9.co.uk> References: <2b768c7d-683e-4ccd-bb16-dae46badf4a6@googlegroups.com> User-Agent: Pluto/3.17i (RISC OS/5.24) NewsHound/v1.52-32 Organization: None X-Editor: Zap 1.48 (12 Jul 2015) tnk-11, ZapEmail 0.28.3 (25 Mar 2005) (32) Lines: 43 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-rttOW8s6G/+MfJ55nblrnqk/DFt41BTXByjEeBnbsA9oFuJPubt11/pkbgWi1YNMfFQ7jfMY6EjBqAM!JNeyqPZ68Rhg3E4fS15wIndWM6yb9XdALr+skUBN0e0fisdiZd8s4mwYro2vrLVgG/MvdGN27qzk!yhI= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2833 Xref: csiph.com comp.sys.acorn.programmer:5467 On 12 Jun in article , 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.