Here you can find the source of mkdirs(File dir)
public static boolean mkdirs(File dir)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**//from w w w . j a v a2s . co m * Just a simple wrapper around `java.util.File.mkdirs()` that fails * when trying to create a folder named "~" */ public static boolean mkdirs(File dir) { String path = dir.getPath().replace('\\', '/'); if (path.equals("~") || path.startsWith("~/") || path.contains("/~/")) { return false; } return dir.mkdirs(); } }