Here you can find the source of createDirectory(String directory, String subDirectory)
private static void createDirectory(String directory, String subDirectory)
//package com.java2s; import java.io.File; public class Main { private static void createDirectory(String directory, String subDirectory) { String dir[];//from w ww . j a v a 2s . com File fl = new File(directory); try { if (subDirectory == "" && fl.exists() != true) fl.mkdir(); else if (subDirectory != "") { dir = subDirectory.replace('\\', '/').split("/"); for (int i = 0; i < dir.length; i++) { File subFile = new File(directory + File.separator + dir[i]); if (subFile.exists() == false) subFile.mkdir(); directory += File.separator + dir[i]; } } } catch (Exception ex) { System.out.println(ex.getMessage()); } } }