code: public static void ensureParentDirectoryExists(File f) throws IOException {
      final File parent = f.getParentFile();
      if (parent != null) {
        java.nio.file.Files.createDirectories(parent.toPath());
      }
    }
docs: Create the parent directories of the given file, if needed.