Here you can find the source of mkdirs(File file)
Parameter | Description |
---|---|
file | a parameter |
public static boolean mkdirs(File file)
//package com.java2s; import java.io.File; public class Main { /**/*w ww .j a v a 2 s . c o m*/ * A safer version of File.mkdirs, which works around * a race in the 1.5 JDK where two VMs creating the same * directory chain at the same time could end up in one * VM failing to create a subdirectory. * @param file */ public static boolean mkdirs(File file) { final File parentFile = file.getAbsoluteFile().getParentFile(); if (!parentFile.exists()) { mkdirs(parentFile); } //As long as someone successfully created the parent file //go ahead and create the child directory. if (parentFile.exists()) { return file.mkdir(); } else { return false; } } }