FILE GLOB

FILE GLOB is a CAOS command which lists files.

Usage
Syntax: FILE GLOB dir (int) spec (string)

This searches the directory specified by dir for all files matching the pattern spec. The results are sent to the input stream: the first line an integer n containing the number of files found, the next n lines containing a filename each. The filenames are global.

dir should be 0 for the current world journal directory, 1 for the main one. The following special codes are recognised in spec at least in lc2e:  matches any single character,   matches any number of characters. matches any of the characters in the brackets. Ranges (e.g.,  ) are allowed, as are some character classes (e.g.  ), probably those allowed by PCRE.

Since this command opens the input stream, you should use FILE ICLO when you are done with it.

Examples
This is valid, and lists the contents of the current journal directory: FILE GLOB 0 "*" SETV va00 INNI SETS va99 INNL * discard rest of line LOOP ADDV va01 1 OUTS INNL OUTS "\n" UNTL va01 eq va00 FILE ICLO

Result: /home/alex/.dockingstation/My Worlds/hh/Journal/build /home/alex/.dockingstation/My Worlds/hh/Journal/wtype

This is inadvisable, and checks if bondi DNA is available: FILE GLOB 1 "../Genetics/*bondi*" DOIF INNI ne 0 * inject ENDI FILE ICLO