Check if a directory exists
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dirpath |
function sys_dir_exists(dirpath) result(exists) character(len=*), intent(in) :: dirpath logical :: exists character(len=512) :: command integer :: exitstat if (get_os_type() == OS_WINDOWS) then command = 'if exist "'//trim(escape_shell_arg(dirpath))//'" (exit 0) else (exit 1)' else command = 'test -d "'//trim(escape_shell_arg(dirpath))//'"' end if call execute_command_line(command, exitstat=exitstat) exists = (exitstat == 0) end function sys_dir_exists