Google+ Followers

Connect

Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Monday, 2 June 2014

How create directory or folder and Sub Folders in Java ?

Java Code Snippets

/**
* create single directory
*/
public static void CreateSingleDirectory(){
File file=new File("c:\\kumaran");
if(!file.exists()){
if(file.mkdir()){
System.out.println("Directory is created");
}
}
else{
System.out.println("File Already exist");
}
}

/**
* create multiple directory
*/
public static void CreateMultipleDirectory(){
File file=new File("c:\\kumaran\\projects\\project1");
if(!file.exists()){
if(file.mkdirs()){
System.out.println("Directories are created");
}
}
else{
System.out.println("Files are Already exist");
}
}

Output



1 comment :

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete

Share this to your friends