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");
}
}
/**
* 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
Comments
Post a Comment
Share this to your friends