java create folder
package com.mkyong.file;
import java.io.File;
public class CreateDirectoryExample {
public static void main(String[] args) {
File file = new File("C:\\Directory1");
if (!file.exists()) {
if (file.mkdir()) {
System.out.println("Directory is created!");
} else {
System.out.println("Failed to create directory!");
}
}
File files = new File("C:\\Directory2\\Sub2\\Sub-Sub2");
if (!files.exists()) {
if (files.mkdirs()) {
System.out.println("Multiple directories are created!");
} else {
System.out.println("Failed to create multiple directories!");
}
}
}
}new File("pathToFile").mkdir();
Also in Java:
- dataframe to dict without index
- writing to a text file java
- check if object is empty java 8
- tower of hanoi program in java using recursion
- islowercase java
- java 8 findany on null list
- java hashmap set value
- official java website
- write file from a specific location in java
- javafx textarea how to make smaller
- java stack methods
- how to find length of array in java
- java swing change label icon
- deleting elements of an array in java
- jsonobject to java object
- how to get length of integer in java
- java check if directory exists
- dicom read with java
- get first 5 characters of string java
- how to create a button in java
- java jaxb unmarshall xml to map
- java iterator example
- java regex replace all characters before
- java previous permutation