ARexx (26/41)

From:Bernd Gollesch
Date:25 Aug 2000 at 14:49:18
Subject:Re: Neither of both Delete() seem to work as needed.

Hello,

>What I want to do is to delete all files in foo:bar/ but leave bar/ intact.
>Do I have to use the c:delete command or is there a solution ?

With rexxsupport.library I would do it like:

/*------------------------------------------------------------------*/
DelDir: PROCEDURE
ARG DirName

/* Check if DirName is a dir */
IF TRANSLATE(WORD(STATEF(DirName), 1)) ~= "DIR" THEN DO
SAY DirName || ": not a directory"
RETURN
END

sep = "/"
IF RIGHT(DirName, 1) = ":" | RIGHT(DirName, 1) = "/" THEN
sep = ""

flist = SHOWDIR(DirName, "ALL")
DO i = 1 TO WORDS(flist)
fname = DirName || sep || WORD(flist, i)
IF TRANSLATE(WORD(STATEF(fname), 1)) = "DIR" THEN
CALL DelDir(fname)
res = DELETE(fname)
END

RETURN
/*------------------------------------------------------------------*/

I dont't know if it works (I'm at work now, so no Amiga available) but
it should do the job you want.

HTH, Bernd

ARexx mailing list - No flames, no overquoting, no crossposting. Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com