check the manual for open(), readline(), close(), substr(), instr(), dir(), FOR loops, WHILE loops and so forth.
as you posted in advanced scripting I assume you have some knowledge of scripting or otherwise you would have not taken on such a task or posted here.
_________________________
!

download KiXnet