Fortran Program Example
in order to delete same files, this is only one Example
useful Tipps:
1.file to delete
2.file to check, whether it exist
3.file name in group to change
------------------------------------------------------------
C Last change: SDF 24 Jan 2007 9:48 am
PROGRAM main
IMPLICIT NONE
INTEGER (KIND=4) i,a,b,diff,len_files
CHARACTER (LEN=60) files
LOGICAL (KIND=4) alive
CHARACTER (LEN=4) num_temp
WRITE(*,*)"name to del: "
WRITE(*,*)"z.B. BM_A1_Hexa_s_v0000.xxx"
WRITE(*,*)""
READ (*,*)files
WRITE(*,*)"num ab : "
READ (*,*)a
100 continue
WRITE(*,*)"num bis : "
READ (*,*)b
diff=b-a
len_files=LEN_TRIM(files)
if (diff.le.0) then
stop
endif
do i=1,diff-1
WRITE (num_temp,'(I4.4)')a+i
files((len_files-7):(len_files-4))=num_temp
files((len_files-2):(len_files))="elf"
INQUIRE(FILE=files,exist=alive)
if (.not.alive) then
cycle
end if
WRITE(*,*)files
OPEN(9,FILE=files)
CLOSE(9,STATUS="delete")
files((len_files-2):(len_files))="bos"
OPEN(9,FILE=files)
CLOSE(9,STATUS="delete")
files((len_files-2):(len_files))="bot"
OPEN(9,FILE=files)
CLOSE(9,STATUS="delete")
files((len_files-2):(len_files))="ous"
OPEN(9,FILE=files)
CLOSE(9,STATUS="delete")
files((len_files-2):(len_files))="out"
OPEN(9,FILE=files)
CLOSE(9,STATUS="delete")
end do
a=b
GOTO 100
END program main
------------------------------------------------------------


没有评论:
发表评论