If file exits, get numeral to append to filename
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file |
file to be checked |
function get_new_file_name(file) result(res) !! If file exits, get numeral to append to filename use utils, only : str !> file to be checked character(len=*), intent(IN) :: file character(len=:), allocatable :: res integer :: pos, i i = 1 do pos = scan(trim(file), ".", back=.true.) res = file(1:pos-1)//" ("//str(i)//")"//file(pos:) if(.not. check_file(res))exit i = i + 1 end do end function get_new_file_name