Here you can find the source of makeDir(File parentFile)
public static void makeDir(File parentFile)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.Stack; public class Main { public static void makeDir(File parentFile) { Stack<File> fileStack = new Stack<File>(); while (!parentFile.exists()) { fileStack.push(parentFile);/* w w w .j a va 2 s. c om*/ parentFile = parentFile.getParentFile(); } while (!fileStack.empty()) { File newFile = fileStack.pop(); newFile.mkdir(); newFile.setReadable(true, false); newFile.setWritable(true, true); newFile.setExecutable(true, true); } } }