I've done the same thing using following code on edit script code and put the start and end date in the variable.
minstring(LoadDate_table1) as StartDate,
maxstring(LoadDate_table1) as EndDate
//order by LoadDate_table1ASC
// now get the values...
let EndDate = peek('EndDate',0) ;
let StartDate = peek('StartDate',0) ;
let EndDay= day(peek('EndDate',0)) ;
let StartDay= day(peek('StartDate',0)) ;
// then clean up...
drop table MinMaxDates ;
Sorry, I though you were looking for startdate and enddate of any field.
I also experience the same problem earlier and ended up with the below code.
for each File in filelist ('$(path)$(CurrentFileName)')
LOAD * FROM [$(path)$(CurrentFileName)] (ansi, fix, no labels, header is line, record is 2 lines);
'$(File)' as FileName
, FileTime( '$(File)' ) as FileTime
, FileSize( '$(File)' ) as Size
next File ;