Article View: comp.sys.amiga.tech
Article #6179Re: AmigaDOS questions!!
From: Gregory Kritsch
Date: Fri, 30 Oct 2020 02:06
Date: Fri, 30 Oct 2020 02:06
31 lines
1791 bytes
1791 bytes
new@ee.udel.edu (Darren New) writes:
>In article <oliphant.4664@telepro.UUCP> oliphant@telepro.UUCP (Mike Oliphant) writes:
>>What is the "accepted" way of scanning through a directory using Examine(),
>>ExNext() while deleting the files as you go? Is there an alternative to
>>having to restart the scan each time you delete a file?
>Just as a guess, I would say the easiest way would probably be to allocate
>memory and hold the names of the files you want to delete all at once.
>If you run out of memory, delete those files and restart the scan. - Darren
I've found that double buffering works rather well:
oldfib = NULL;
while (ExNext(lk, fib)) {
if (oldfib) remove(oldfib->fib_Filename);
else oldfib = malloc(sizeof(struct FileInfoBlock);
CopyMemQuick(fib,oldfib,sizeof(struct FileInfoBlock);
}
remove(oldfib->fib_FileName);
You have to do the copy, since you must use the same FileInfoBlock with
ExNext (and despite Transactor's claim that only the fib_Key field must
be preserved, the AmigaDOS manual states the entire structure must be
preserved).
>--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
--
Gregory Kritsch | University of Waterloo
Fido: 1:221/208.11110 [1:163/109.30] | 1A Computer Engineering
UUCP: ggk@tirith.UUCP |--------------------------
...!watmath!xenitec!tirith!ggk | Amiga Fanatic
Technical Details
Message-ID:
<ggk.657252410@tirith.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!xenitec!tirith!ggkReferences:
<34801@nigel.ee.udel.edu> <1990Oct11.212541.18365@hoss.unl.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!xenitec!tirith!ggk From: ggk@tirith.UUCP (Gregory Kritsch) Message-ID: <ggk.657252410@tirith.UUCP> Date: 30 Oct 20 02:06:50 Newsgroups: comp.sys.amiga.tech Subject: Re: AmigaDOS questions!! In-Reply-To: new@ee.udel.edu (Darren New) References: <34801@nigel.ee.udel.edu> <1990Oct11.212541.18365@hoss.unl.edu>