I\'m working with numerical weather forecast named as follow:
sub_gfsanl_4_2011MMDD-IIII-FFFF.grb2
-MM stands for month from 01 to 12
<
Well thanks to Vladimir suggestion here what i did to solve my problem!
program test_ec
implicit none
integer :: mi,di,iiii,fff
character(len=1024) :: filename
character(len=1024) :: format_string
logical exist
mi=1
CALL chdir('/media/Hello/ncfiles/GFS' )
!do di=1,10
do iiii=0,18,6
do fff=0,18,6
format_string = "(A17,i2.2,i2.2,A1,i4.4,A1,i3.3,A8)"
write (filename,format_string) "sub_gfsanl_4_2011",mi,di,"_",iiii,"_",fff,".grb2.nc"
inquire(file=trim(filename), exist=exist)
if (exist) then
write(*,*) 'file exists i can do do whatever i want with this file'
else
write(*,*) 'I did not find that file.'
end if
enddo
enddo
enddo
end program test_ec