Java Path Create nio createDirIfDoesNotExist(String websitesDirPath)

Here you can find the source of createDirIfDoesNotExist(String websitesDirPath)

Description

create Dir If Does Not Exist

License

Open Source License

Declaration

public static void createDirIfDoesNotExist(String websitesDirPath) 

Method Source Code


//package com.java2s;
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 createDirIfDoesNotExist(String websitesDirPath) {
        Path directoryPath = Paths.get(websitesDirPath);

        if (!Files.exists(directoryPath)) {
            try {
                Files.createDirectory(directoryPath);
            } catch (IOException e) {
                e.printStackTrace();// w  ww.jav  a 2s.com
            }
        }
    }
}

Related

  1. createDir(Path p)
  2. createDirectoriesIfRequired(@Nonnull Path path)
  3. createDirectory(final Path parent, final String folderName)
  4. createDirectory(Path parent, String name)
  5. createDirectory(Path path)
  6. createEmptyResourceFile(Path path)
  7. createFile(File root, String path, String filename, String value)
  8. createFile(final Path file, final String line)
  9. createFile(Path filePath, byte[] content)