Name
ReadDirectory -- read a directory into a string array
Synopsis
fcount, dcount = ReadDirectory(dir$, files$, dirs$[, sort])
Function
This function examines the directory specified by dir$ and puts all filenames found in the directory tree to the string array specified in files$ and all directory names to the string array specified in dirs$. After the last item, this function will insert an empty string into the array, so you know how many files/directories were found.

By default, all file and directory entries will be automatically sorted by this function. If you do not want this behaviour, you can set the optional argument sort to False.

Starting with Hollywood 2.0 this function returns two values: The first return value indicates how many files were in the directory and the second one indicates how many subdirectories were in the directory.

Inputs
dir$
directory to examine
files$
string array to put the filenames to
dirs$
string array to put the directory names to
sort
optional: whether or not file and directory names shall be sorted (V4.5)
Results
fcount
number of files in dir$ (V2.0)
dcount
number of subdirectories in dir$ (V2.0)
Example
f$ = {}
d$ = {}
ReadDirectory("Data", f$, d$)
The above code reads the contents of the "Data" directory into the string arrays f$ and d$.

Show TOC