delete_file Subroutine

public subroutine delete_file(file)

delete a file by filename

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file

Source Code

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