Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void makeDirectoryOnly(File file) { String[] partial = file.getAbsolutePath().split("/"); String path = "/"; for (int i = 0; i < partial.length - 1; ++i) { path += partial[i] + '/'; } new File(path).mkdirs(); } }