program test
integer i
real s,a
character(512)::filename
call system('dir *.txt /b>1.dat')
s=0.0
open(10,file='1.dat')
do
read(10,'(a)',iostat=i) filename
if(i/=0) exit
open(11,file=filename)
read(11,*) a
close(11)
s = s + a
end do
close(10,status='delete')
end program