BBS: Inland Empire Archive
Date: 02-25-93 (23:55)             Number: 178
From: ROB MCKEE                    Refer#: NONE
  To: OWEN GIBBINS                  Recvd: NO  
Subj: DIRECTORIES 1/3                Conf: (2) Quik_Bas
Hello Owen!
   You wrote to All:

 OG> In BASIC, how do you get a list all the files and
 OG> subdirectories in the current directory. I know there's the
 OG> FILES command, but how do you store every
 OG> filename/subdirectory name in a variable. Also, I don't want
 OG> to have to shell to DOS.

In QB45 or PDS:

    ' $DYNAMIC
    TYPE RegTypeX
        ax       AS INTEGER
        bx       AS INTEGER
        cx       AS INTEGER
        dx       AS INTEGER
        bp       AS INTEGER
        si       AS INTEGER
        di       AS INTEGER
        flag     AS INTEGER
        ds       AS INTEGER
        es       AS INTEGER
    TYPE DFileType
        Fname       AS STRING * 12
        FDate       AS STRING * 8
        FTime       AS STRING * 8
        cattr       AS STRING * 7
        DSize       AS STRING * 10
        DSlack      AS INTEGER
        attribute   AS INTEGER
    TYPE FileType
        Fname    AS STRING * 12
        year        AS INTEGER
        month       AS INTEGER
        day         AS INTEGER
        FDate       AS STRING * 10
        hour        AS INTEGER
        minute      AS INTEGER
        second      AS INTEGER
        FTime       AS STRING * 8
        attribute   AS INTEGER
        Size        AS LONG
    TYPE DiskSizeType
        Drive   AS INTEGER
        TotCl   AS LONG
        AvaCl   AS LONG
        SecCl   AS LONG
        SecSz   AS LONG
        CluSz   AS LONG
        free    AS LONG
        Total   AS LONG
        Used    AS LONG
    DECLARE FUNCTION GoodFileName$ (FilName$)
    DECLARE SUB GetDiskSize (DkSz AS DiskSizeType, UsPath$)
    DECLARE SUB GetFileData (dta$, File AS FileType)
    DECLARE SUB KillFile (FilName$, FilAttribute%, Result%)
    DECLARE SUB findfirstfile (Path$, dta$, Result%)
    DECLARE SUB FindNextFile (dta$, Result%)
    DECLARE SUB SetFileAttribute (UsPath$, FilName$, FilAttribute%, Result%)

    CONST false = 0, true = NOT false, Move = 1, Normal = 2,_
    ReadOnly = 4,_
    Hidden = 8, Archive = 16, EveryThing = 30, DelFileInt21h = &H4100,_
    MoveFilePointerInt21h = &H4200,_
    SetDTAInt21h = &H1A00,_
    GetDTAInt21h = &H2F00, GetDiskFreeSpaceInt21h = &H3600

    DIM RegX AS RegTypeX, File AS FileType, DkSz AS DiskSizeType, _
kf$(200), ka%(1 TO 200)
    Get2Parm InFile$, OutFile$, UsPath$, Parm%
    DIM att(5) AS STRING * 1
    att(0) = "R": att(1) = "H": att(2) = "S": att(3) = "L": _
    att(4) = "D": _
    att(5) = "A"
    findfirstfile FileSpec$, dta$, Result%

 '>>> Continued Next Message

--- timEd/B6
 * Origin: Flyer_Proof_Computer_Svs,Richmond_CA,MO,V32B (1:125/411)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET