DIR$( [fspec], [type] )
Will search an SD card for files and return the names of entries found. ‘fspec’ is a file specification using wildcards the same as used by the FILES command. Eg, “*.*” will return all entries, “*.TXT” will return text files. ‘type’ is the type of entry to return and can be one of:
VOL Search for the volume label only
DIR Search for directories only
FILE Search for files only (the default if ‘type’ is not specified)
The function will return the first entry found. To retrieve subsequent entries use the function with no arguments. ie, DIR$( ). The return of an empty string indicates that there are no more entries to retrieve.
This function only operates on the SD card and you must change to the required directory before invoking it.