Java examples for File Path IO:Directory Create
Create directory along with required nonexistent parent directories
import java.io.*; public class Main { public static void main(String[] args) { //from w w w.jav a2 s . c om File dir = new File("C://Folder//Parent1//Parent2//DemoDir"); boolean isDirCreated = dir.mkdirs(); if(isDirCreated) System.out.println("Directory created along with required nonexistent parent directories"); else System.out.println("Failed to create directory"); } }