Main sections
GETFILELIST()
num = GETFILELIST(find$, files$[])
Get a list of file and directory names from the current working directory. find$ specifies a wildcard search string where '*' represents 0 or more characters and '?' represents exactly one undefined character. Thus the search string "?at.*" would match all of the following :-
cat.bmp
rat.txt
mat.exe
At.gbas
'num' is num_directories * 0x10000 + num_files. Thus it's stored in high word and low word bytes. The sample explains how to receive both values.
Sample:
// --------------------------------- //
// Project: Files and Folders
// Start: Tuesday, November 25, 2003
// IDE Version: 1.31125
 LOADFONT "minifont.bmp", 0
 GETFONTSIZE font_x, font_y
 
 ok = SETCURRENTDIR("..") // One up
 cur$ = GETCURRENTDIR$()
 num = GETFILELIST("*.*", files$[])
 num_dir  = INTEGER(num / 0x10000) // Hi-Word
 num_file = MOD(num, 0x10000)      // Lo-Word
 PRINT cur$, 0, 0
 PRINT "ok? " + ok+ " num: " + num + " -> nDir: "+num_dir+" nFile: "+num_file, 0, font_y
 FOR i=0 TO BOUNDS(files$[], 0)-1 // BOUNDS(files$[], 0)-1 = num = num_dir+num_file
  PRINT files$[i], 0, (i+3)*font_y
 NEXT
 
 SHOWSCREEN
 MOUSEWAIT

