` Printed Icetips Article

Icetips Article



Par2: Procedure to get disk directory tree
1999-05-13 -- Chris Behling
 
Here's the source procedure I use -- should work fine!!  You would probably
define a que to keep all the HoldDir descriptions in -- could be Global or
passed into the procedure.

RecursiveDir(STRING WhichDir)

Local Data Embed:

FileQue       QUEUE

name                    STRING(13)
date                    LONG
time                    LONG
size                    LONG
attrib                  BYTE        !A bitmap, the same as the attributes
EQUATEs
              END

HoldDir    STRING(100)


Processed Code Embed:

    ! recursive routine that gets all directories
    ! get all of the directories
    DIRECTORY(FileQue,CLIP(WhichDir) & '*.*',ff_:DIRECTORY)            !Get
all files and directories
    SORT(FileQue,+FileQue.name)
    Recs# = RECORDS(FileQue)
    LOOP a# = 1 TO Recs#
        GET(FileQue,a#)
        IF BAND(FileQue.attrib,ff_:DIRECTORY) AND FileQue.name <> '..' AND
FileQue.name <> '.'
            ! do your stuff here
            !
            !
            ! call dir routine again
            HoldDir = CLIP(WhichDir) & CLIP(FileQue.name) & '\'
            RecursiveDir(HoldDir)
        END
    END



Printed November 21, 2024, 12:28 pm
This article has been viewed/printed 35320 times.