Here you can find the source of mkDir(String fullPath, String directoryPath)
private static void mkDir(String fullPath, String directoryPath)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { private static void mkDir(String fullPath, String directoryPath) { String[] dirctories = directoryPath.split("/"); if (dirctories == null || dirctories.length <= 1) { return; }//from w w w . j a v a2 s . c o m File directory = new File( fullPath.substring(0, fullPath.indexOf("/" + dirctories[0] + "/") + dirctories[0].length() + 1)); // log.info(directory); if (!directory.exists()) { directory.mkdir(); } else if (!directory.isDirectory()) { directory.delete(); directory.mkdir(); } int index = directoryPath.indexOf("/"); String dirctoryStr = index != -1 ? directoryPath.substring(index + 1, directoryPath.length()) : ""; mkDir(fullPath, dirctoryStr); } }