You can scan a native directory to build a list of files in one of two ways. The first way would be to use HOSTEXxs to launch a native operating system utility to build such a list and output it to a file, and then open the file for input to read it in. This works better in Unix than in Windows, which doesn’t have a standard way of generating a directory list in a file.
The second way is to use MX_FINDFIRST and MX_FINDNEXT to scan the directory. Start with MX_FINDFIRST to position your "directory cursor" at the start of a specified directory, and then use MX_FINDNEXT repeatedly until it returns a non-zero status, indicating it has hit the end of the directory.