Java tutorial
//package com.java2s; import java.io.File; public class Main { static void createParentDirs(File file) { File dir = file.getParentFile(); if (dir != null && !dir.exists() && !dir.mkdirs()) throw new IllegalStateException("Couldnt create " + dir); } }