Liberty BASIC Help Online

The FILES statement collects file and directory information from any disk and or directory and fills a double-dimensioned array with the information.  It is also good for determining if a specific file exists (see below).
dim arrayName$(10, 10)
files pathSpec$, arrayName$(
files pathSpec$, arrayName$()
    'you must predimension the array info$(),
    'even though FILES will
    'redimension it to fit the information it provides.
    dim info$(10, 10)
    files "c:\", info$()
The above FILES statement will fill info$( ) in this fashion:
    info$(0, 0) - a string specifying the qty of files found
    info$(0, 1) - a string specifying the qty of subdirectories found
    info$(0, 2) - the drive spec
    info$(0, 3) -  the directory path
Starting at info$(1, x) you will have file information:
    info$(1, 0) - the file name
    info$(1, 1) - the file size
    info$(1, 2) - the file date/time stamp
Knowing from info$(0, 0) how many files we have (call it n), we know that our subdirectory information starts at n + 1, so:
    info$(n + 1, 0) - the complete path of a directory entry (ie. \work\math)
    info$(n + 1, 1) - the name of the directory in specified (ie. math)
You can optionally specify a wildcard.  This lets you get a list of all *.ini files, for example.  This is how you do it:
    files DefaultDir$, "*.ini", info$(
This also makes it practical to use to check for file existence.  If you want to know if a file c:\config.bak exists, you could try...
    files "c:\", "config.bak", info$(
    If val(info$(0, 0)) > 0, then the file exists.

Copyright (C) 2003 Shoptalk Systems
Liberty BASIC -