Java Path Copy nio createDirectoryRecursively(String dirName)

Here you can find the source of createDirectoryRecursively(String dirName)

Description

create Directory Recursively

License

BSD License

Declaration

public static void createDirectoryRecursively(String dirName) throws IOException 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;

import java.nio.file.Paths;

public class Main {
    public static void createDirectoryRecursively(String dirName) throws IOException {
        Path newDirectoryPath = Paths.get(dirName);
        if (Files.exists(newDirectoryPath)) {
            throw new java.nio.file.FileAlreadyExistsException("directory " + dirName + " already exists");
        }/*from  w w  w. j a  v  a 2 s.  co  m*/
        Files.createDirectories(newDirectoryPath);
    }
}

Related

  1. createDirectory(Path directory)
  2. createDirectory(Path outDir, boolean cleanExisting)
  3. createDirectory(Path parent, String name)
  4. createDirectoryIfNotExists(Path path)
  5. createDirectoryRecursively(Path dir)
  6. renameTo(Path from, Path to, CopyOption... options)
  7. write(InputStream in, Path path, StandardCopyOption op)