Java examples for File Path IO:Directory Create
Create a directory; all non-existent ancestor directories are automatically created
import java.io.File; public class Main { public static void main(String[] args) throws Exception { // Create a directory; all ancestor directories must exist boolean success = (new File("directoryName")).mkdir(); if (!success) { // Directory creation failed }/*from w ww .j av a 2s .c om*/ success = (new File("directoryName")).mkdirs(); if (!success) { // Directory creation failed } } }