Here you can find the source of makeDirs(String filePath)
public static boolean makeDirs(String filePath)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static boolean makeDirs(String filePath) { String folderName = getFolderName(filePath); if (folderName == null || folderName.trim().length() == 0) { return false; }/*from w ww.j a va 2s.c o m*/ File folder = new File(folderName); return (folder.exists() && folder.isDirectory()) ? true : folder.mkdirs(); } public static String getFolderName(String filePath) { if (filePath == null || filePath.trim().length() == 0) { return filePath; } int filePosi = filePath.lastIndexOf(File.separator); return (filePosi == -1) ? "" : filePath.substring(0, filePosi); } }