Create Directory with Java



User Rating:  / 0
PoorBest 
Details
Category: Java
Created on Friday, 16 November 2012 10:06
Last Updated on Friday, 16 November 2012 10:06
Published on Friday, 16 November 2012 10:06
Written by Administrator
Hits: 5759

Simple code for create Directory in java :

View source
package com.developerpages.snippets.core;
 
import java.io.File;
 
public class CreateDirectory {
 
    public static void main(String[] args) {
        File dir = new File("c://mydir");
        boolean directoryCreated = dir.mkdir();
        if (directoryCreated) {
            System.out.println("My Directory created");
        } else {
            System.out.println("My Directory not created");
        }
    }
}