delete a file by filename
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file |
subroutine delete_file(file)
character(len=*), intent(in) :: file
logical :: exist
integer :: unit
inquire(file=file, exist=exist)
if (exist) then
open(file=file, newunit=unit)
close(unit, status="delete")
end if
end subroutine delete_file