Task

Walk a given directory and print the names of files matching a given pattern.

(How is "pattern" defined? substring match? DOS pattern? BASH pattern? ZSH pattern? Perl regular expression?)


Note: This task is for non-recursive methods.   These tasks should read a single directory, not an entire directory tree.

Note: Please be careful when running any code presented here.



Related task

   Walk Directory Tree   (read entire directory tree). 


INT match=0, no match=1, out of memory error=2, other error=3;
 
[]STRING directory = get directory(".");
FOR file index TO UPB directory DO
  STRING file = directory[file index];
  IF grep in string("[Ss]ort*.[.]a68$", file, NIL, NIL) = match THEN
    print((file, new line))
  FI
OD