Technical Notes |
|
The FILES object reads a list of files from a specified directory into a TMS-like table called FILES. The following code steps through a list of files and displays each file name in a message box. Fields used by the FILES object need to be defined in the application.
FUNCTION START START{ LOAD SUBAP xteb xctrl INIT BASE # What file mask? Can use expressions SET ddamask '[A-Z_a-z/0-9]*\.* *' # What file directory? SET inputdir 'C:\mydir' fill FILES NOCURR FILES repeat { NEXT FILES FERROR BASE filebasename(filename) }}FUNCTION fill FILES{ PUSHDIR FILES inputdir SRCCLEAR FILES == filetype 'FILE' == filereadable 'yes' LOG BASE ddamask REGEXP filename ddamask SELECT FILES}FIELD ddamask string(32)FIELD inputdir string(250)# Fields for FILES pseudo table objectFIELD filename string(250)FIELD filetype string(16) EXPR=FILE|DIRECTORYFIELD filereadable string(3) EXPR=yes|noFIELD filewritable LIKE filereadableFIELD fileexecutable LIKE filereadable |