Is it possible in Fortran to open several folders, read the file inside it (there is only one file in each folder and each has the same filename), and then write the data (array 2x40 data, but only the second column will be taken) into a single file?
I tried to write the program that Folders name are in real number (0, 0.05, ... ,10), change it into character and opened in every loop as written below, but seems the line to open folders and file don't work.
program results
implicit none
integer, parameter :: nx = 100, ny = 40, lmax = 2, mmax=40
character(*), parameter :: fileplace = "/home/sampleDict"
character(*) :: string
integer :: i=0, k=0
integer :: l,m
real(8) :: fn=0
integer, dimension(lmax, mmax) :: A
open (unit=200,file='elevation.csv', status='unknown')
do i=i+1,nx
fn=fn+0.05
write(string,*) fn
open(unit=i,file=fileplace//trim(adjustl(string))//'data.csv',status='old')
read(i,*) ((A(l,m),l=1,lmax),m=1,mmax)
write(200,*) A(2,m)
enddo
end program