C C PROGRAM TO NUMBER FILES IN A DIRECTORY using * c or selected files using other search string for ls C c c j. havskov many years ago, who knows c e. hjortenberg 910116 unix adaptation c c. Lindholm, Some unix improvement c oct 10 94 filename to 70 c jan 95 : *********** version 5.0 ********************** c sep 17 98 by jh : ----------------- version 7.0 check ----------------- c no changes c nov 5 : linux logic c oct 25 2000 jh : write more than 1000 files c nov 14 2006 jh : stop if too many files c dec 19 2010 jh : gfortran on pc c c IMPLICIT none include 'seidim.inc' c-- HEADER TEXT character*80 files(max_dirf) character*80 args ! argument c-- COUNTERS INTEGER NR, nargs,i,nf,i1 c c print version c include 'version.inc' out_version_date='July 23, 2001' if (version_new) out_version_date=version_date call print_ver NR=0 c c get argument from command line c call get_arguments(nargs,files) if (nargs.gt.0) then go to 10 else stop endif c 10 CONTINUE C nf=nargs i1=1 nr=0 OPEN(2,FILE='filenr.lis',STATUS='unknown') c c error c if(nf.ge.max_dirf) then write(6,*) ' Number of input files: ',nf write(6,*) ' Maximum is: ', max_dirf write(6,*) ' Program terminated' stop endif c do i = i1,nf nr=nr+1 WRITE(2,200) nr,FILEs(i)(1:70) WRITE(6,200) nr,FILEs(i)(1:70) enddo 200 FORMAT(1X,I4,2X,A70) c-- END OF FILE 20 CONTINUE c-- BLANK LAST LINE WRITE(2,*) ' ' close(2) 255 continue END