Here you can find the source of createDirectoryRecursively(Path dir)
Parameter | Description |
---|---|
dir | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void createDirectoryRecursively(Path dir) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class Main { /**//from www .jav a 2 s .co m * Attempts to create a directory given a String path. * * @param dir * @throws IOException */ public static void createDirectoryRecursively(Path dir) throws IOException { // Attempt to create a directory try { Files.createDirectories(dir); } catch (IOException e) { throw new IOException( "Exception while trying to create directory: " + e); } // Verify the directory was successfully created if (!dir.toFile().exists()) { throw new IOException( "Failed to verify directory creation - directory does not exist."); } } }