File Scan

This example will scan through all daily files in the Future folder.  The Future folder has 26 sub-folders, one for each letter of the alphabet. Daily files for futures are stored in a folder according to the first letter of the file name.

This script illustrates the FindFirst, FindNext and FindClose functions that implement the scan through a directory of file names.

var
  s: string;
  i: integer;
begin
  if who=3 then begin
    for i:=1 to 26 do begin
      s:=chr(i+64);
      s:=FindFirst(sPath+'Future\'+s+'\'+s+'*.*');
      while length(s)>0 do begin
        writeln(s);
        s:=FindNext;
      end;
      FindClose;
    end;
  end;
end;