Recursively create a directory path without invoking a shell.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path | |||
| integer, | intent(out) | :: | status |
subroutine create_directories(path, status) character(len=*), intent(in) :: path integer, intent(out) :: status integer :: i, path_length status = filesystem_success path_length = len_trim(path) if (path_length == 0) then status = filesystem_empty_path return end if do i = 1, path_length if (path(i:i) /= '/') cycle if (i <= 1) cycle call create_one_directory(path(:i - 1), status) if (status /= filesystem_success) return end do call create_one_directory(path(:path_length), status) end subroutine create_directories