List of utility methods to do mkdir
boolean | makeDirectory(String path, String directoryName) Create a directory in the given path
File f = new File(path, directoryName); if (!f.exists()) { return f.mkdir(); return false; |
void | makeDirectory(String sDir) make Directory File fDir = new File(sDir); if (!fDir.exists()) fDir.mkdirs(); if (fDir.isFile()) { throw new java.io.IOException("The file with the same name already exists. - " + sDir); |
void | makeDirectoryWorldAccessible(File directory) make Directory World Accessible if (!directory.isDirectory()) { throw new IOException(directory + " must be a directory"); makeWorldReadable(directory); if (!directory.setExecutable(true, false )) { throw new IOException("Unable to make " + directory + " world-executable"); |
void | makeDirForPath(String path) make Dir For Path File file = new File(path); File dir = new File(file.getParent()); makeDir(dir.getPath()); |
void | makeDirIfNotExists(File... paths) Create any directory in the list paths if it doesn't exist for (File f : paths) {
makeDirIfNotExists(f.getAbsolutePath());
|
void | makeDirRecursive(File f) Make the directory. if (f == null) { return; if (f.exists()) { return; makeDirRecursive(f.getParentFile()); f.mkdir(); ... |
void | makeDirs(@Nullable File dir) Creates dir and its parents if (dir != null && !dir.exists() && !dir.mkdirs()) { throw new IOException("unable to create directory (or parents): " + dir); |
boolean | makeDirs(File dir, int numTries) Create a directory and its parent directories if necessary. if (numTries < 1) { throw new IllegalArgumentException("number of tries must be greater than zero"); int tries = 0; while (tries++ < numTries) { boolean result = dir.mkdirs(); if (result) { return true; ... |
boolean | makeDirs(File f) Make a directory and its parents, returning true if and only if the dir exists. if (f.exists()) { if (!f.isDirectory()) { return false; return true; return f.mkdirs(); |
void | makeDirs(File file) make Dirs file = new File(file.getAbsolutePath()); File parent = file.getParentFile(); if (!parent.exists()) makeDirs(parent); parent.mkdir(); |