Create Directories with java.nio.file.Files in Java
Description
The following code shows how to create Directories with java.nio.file.Files.
Example
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
// w w w . j a v a 2s . c om
public class Main {
public static void main(String[] args) throws Exception {
Path directoriesPath = Paths.get("C:/home/test/subtest/subsubtest");
Path testDirectory = Files.createDirectories(directoriesPath);
System.out.println("Directory sequence created successfully!");
}
}
The code above generates the following result.