Java Create Directory mkdirs(String parentName, String childName)

Here you can find the source of mkdirs(String parentName, String childName)

Description

mkdirs

License

Open Source License

Declaration

public static boolean mkdirs(String parentName, String childName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean mkdirs(String dirName) {
        return mkdirs(new File(dirName));
    }/*www.  j a  v a2s .c om*/

    public static boolean mkdirs(String parentName, String childName) {
        return mkdirs(new File(parentName, childName));
    }

    public static boolean mkdirs(File file) {
        if (file.exists()) {
            if (!file.isDirectory()) {
                throw new RuntimeException("File '" + file + "' is not a directory.");
            }
            return false;
        }
        if (file.mkdirs())
            return true;
        throw new RuntimeException("Failed to create directory '" + file + "'");
    }

    public static boolean exists(String fileName) {
        return (new File(fileName)).exists();
    }
}

Related

  1. mkdirs(String filePath)
  2. mkdirs(String filePath)
  3. mkDirs(String filePath)
  4. mkdirs(String name)
  5. mkdirs(String packageName, File root)
  6. mkDirs(String path)
  7. mkdirs(String path)
  8. mkdirs(String path, boolean deleteBeforeCreate)
  9. mkdirs(String path, boolean override)