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).

Usage:

dim arrayName$(10, 10)

files pathSpec$, arrayName$(

or

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: