You can do this by capturing the output of "ls -1 *.csv". The -1 option tells ls to list each file on a separate line.
The >pShell word captures the output of a shell command and sends it to xtype. The xtype word then splits the output on each line feed character and prints the output line by line.
First we'll create a word to process each filename:
: process-file
s" Next file is >> " type // display message
type // now show the filename
;
now we'll update the xtype word. Change line 86 in shell.fth from:
if type else 2drop endif \ type left string
to the following:
if process-file else 2drop endif \ do something for each file
The >pShell word will continue to use the old copy of xtype until you redefine it, so just copy and paste the code for >pShell into the terminal again.
cr z" ls -1 Doc/*pdf" >pShell
Next file is >> Doc/FPgoldberg.pdf
Next file is >> Doc/ProgramForth.pdf
Next file is >> Doc/VfxLin64.pdf