|
Prev: compiler/linker flags to abort array assignment (non-standard)use during run time
Next: Can I create header file dependent by gfortran
From: octaedro on 23 Apr 2008 15:04 Hi, I am trying to organize my computation results. I get a lot of output files for many different parameter values. The specific problem does not matter. I was wondering if I could create automatically folders from fortran so each set of results is stored in a different folder or subfolder.... ie. C:\Research\lifecycle\results001\output01.out C:\Research\lifecycle\results001\output02.out C:\Research\lifecycle\results001\output03.out ... C:\Research\lifecycle\results002\output01.out C:\Research\lifecycle\results002\output02.out C:\Research\lifecycle\results002\output03.out ... I know I can write a .bat program to do it but I would have to refresh my knowledge and I am a bit short of time. Thank you as always, Jorge Alonso
From: GaryScott on 23 Apr 2008 15:26 On Apr 23, 2:04 pm, octaedro <jorge.alonsoor...(a)gmail.com> wrote: > Hi, > > I am trying to organize my computation results. I get a lot of output > files for many different parameter values. The specific problem does > not matter. I was wondering if I could create automatically folders > from fortran so each set of results is stored in a different folder or > subfolder.... ie. > > C:\Research\lifecycle\results001\output01.out > C:\Research\lifecycle\results001\output02.out > C:\Research\lifecycle\results001\output03.out ... > > C:\Research\lifecycle\results002\output01.out > C:\Research\lifecycle\results002\output02.out > C:\Research\lifecycle\results002\output03.out ... > > I know I can write a .bat program to do it but I would have to refresh > my knowledge and I am a bit short of time. > Well, usually but may depend on which compiler/OS you're using. Most commercial ones provide APIs for file system interfacing. > Thank you as always, > > Jorge Alonso
From: glen herrmannsfeldt on 23 Apr 2008 16:08 octaedro wrote: > I am trying to organize my computation results. I get a lot of output > files for many different parameter values. The specific problem does > not matter. I was wondering if I could create automatically folders > from fortran so each set of results is stored in a different folder or > subfolder.... ie. (snip) > I know I can write a .bat program to do it but I would have to refresh > my knowledge and I am a bit short of time. Write a Fortran program to output MKDIR commands to create the needed directories as a .BAT file. Execute it. Then run your program to create files in the existing directories. One warning, though. Some Fortran compilers process the C escape sequences which requires doubling of backslash in your program. That is the easy way that doesn't require any refreshing. -- glen
From: e p chandler on 23 Apr 2008 16:34 On Apr 23, 3:04 pm, octaedro <jorge.alonsoor...(a)gmail.com> wrote: > Hi, > > I am trying to organize my computation results. I get a lot of output > files for many different parameter values. The specific problem does > not matter. I was wondering if I could create automatically folders > from fortran so each set of results is stored in a different folder or > subfolder.... ie. > > C:\Research\lifecycle\results001\output01.out > C:\Research\lifecycle\results001\output02.out > C:\Research\lifecycle\results001\output03.out ... > > C:\Research\lifecycle\results002\output01.out > C:\Research\lifecycle\results002\output02.out > C:\Research\lifecycle\results002\output03.out ... > > I know I can write a .bat program to do it but I would have to refresh > my knowledge and I am a bit short of time. > > Thank you as always, > > Jorge Alonso Use an internal write to create the path string for each directory. Format In.n pads with leading zeroes. Shell out to create the directory using the MD commmand. On some compilers this is a function or subroutine called SYSTEM. Use an internal write to create 8.3 filename string. open(unit,file = path_string // filename_string) etc., etc. Here's a program skeleton: implicit none integer i1,i2 character*33 s1 character*12 s2 do i1=1,2 write(s1,100) i1 ! non-fatal error if exists 100 format('C:\Research\lifecycle\results',i3.3,'\') call system('md ' // s1) do i2=1,3 write(s2,200) i2 200 format('output',i2.2,'.out') open(10,file=s1 // s2) write(10,*) 'I am file ' // s1 // s2 close(10) end do end do end HTH --- e
From: Gerry Ford on 23 Apr 2008 18:31
"e p chandler" <epc8(a)juno.com> wrote in message news:b1a9908b-d5ce-42f1-ae8e-60c2ff4e37e0(a)e53g2000hsa.googlegroups.com... On Apr 23, 3:04 pm, octaedro <jorge.alonsoor...(a)gmail.com> wrote: > Hi, > > I am trying to organize my computation results. I get a lot of output > files for many different parameter values. The specific problem does > not matter. I was wondering if I could create automatically folders > from fortran so each set of results is stored in a different folder or > subfolder.... ie. > > C:\Research\lifecycle\results001\output01.out > C:\Research\lifecycle\results001\output02.out > C:\Research\lifecycle\results001\output03.out ... > > C:\Research\lifecycle\results002\output01.out > C:\Research\lifecycle\results002\output02.out > C:\Research\lifecycle\results002\output03.out ... > > I know I can write a .bat program to do it but I would have to refresh > my knowledge and I am a bit short of time. > > Thank you as always, > > Jorge Alonso Use an internal write to create the path string for each directory. Format In.n pads with leading zeroes. Shell out to create the directory using the MD commmand. On some compilers this is a function or subroutine called SYSTEM. Use an internal write to create 8.3 filename string. open(unit,file = path_string // filename_string) etc., etc. Here's a program skeleton: implicit none integer i1,i2 character*33 s1 character*12 s2 do i1=1,2 write(s1,100) i1 ! non-fatal error if exists 100 format('C:\Research\lifecycle\results',i3.3,'\') call system('md ' // s1) do i2=1,3 write(s2,200) i2 200 format('output',i2.2,'.out') open(10,file=s1 // s2) write(10,*) 'I am file ' // s1 // s2 close(10) end do end do end --->This works like a charm. When I run it a second time, I get a notification that the folders or files already exist, but it writes to the files just fine. -- "Life in Lubbock, Texas, taught me two things: One is that God loves you and you're going to burn in hell. The other is that sex is the most awful, filthy thing on earth and you should save it for someone you love." ~~ Butch Hancock |