Java Utililty Methods Create Directory

List of utility methods to do Create Directory

Description

The list of methods to do Create Directory are organized into topic(s).

Method

voidmkdirs(String fileName, String baseName)
mkdirs
String path = baseName + fileName.substring(0, fileName.lastIndexOf(File.separator));
new File(path).mkdirs();
booleanmkdirs(String filePath)
mkdirs
File file = new File(filePath);
boolean result = false;
if (!file.exists()) {
    result = file.mkdirs();
return result;
booleanmkdirs(String filePath)
mkdirs for a file;
File file = new File(filePath);
if (!file.exists()) {
    String parent = file.getParent();
    return new File(parent).mkdirs();
} else {
    return false;
BooleanmkDirs(String filePath)
mk Dirs
String dirPath = new File(filePath).getParentFile().getAbsolutePath() + File.separator;
File dir = new File(dirPath.replace("/", File.separator));
return dir.exists() || dir.mkdirs();
booleanmkdirs(String name)
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
File file;
if (name == null) {
    return false;
file = new File(name);
return file.mkdirs();
Filemkdirs(String packageName, File root)
mkdirs
String[] dirs = packageName.split("\\.");
for (String dir : dirs) {
    File f = new File(root, dir);
    if (!f.exists()) {
        f.mkdir();
    root = f;
return root;
booleanmkdirs(String parentName, String childName)
mkdirs
return mkdirs(new File(parentName, childName));
voidmkDirs(String path)
Create dirs
(new File(path)).mkdirs();
voidmkdirs(String path)
mkdirs
if (path == null) {
    return;
path = getJavaFileSystemPath(path);
if (!path.endsWith(sp)) {
    path = path + sp;
java.io.File dir = new java.io.File(path);
...
voidmkdirs(String path, boolean deleteBeforeCreate)
mkdirs
File file = new File(path);
if (deleteBeforeCreate)
    delete(file);
file.mkdirs();