Delete the file with the given name.
Use this in the beginning of the application, to clear old logs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | filename | Name of the file to delete. |
subroutine tem_probing_delete(filename)
! -------------------------------------------------------------------- !
!> Name of the file to delete.
character(len=*) :: filename
! -------------------------------------------------------------------- !
logical :: is_oldfile
integer :: probeunit
! -------------------------------------------------------------------- !
inquire(file=trim(filename), exist = is_oldfile)
probeunit = newunit()
if (is_oldfile) then
open( probeunit, file=filename, status='old', position='append', &
& action='write' )
else
open( probeunit, file=filename, status='new', action='write' )
end if
close(probeunit, status='delete')
end subroutine tem_probing_delete