List of utility methods to do Create Directory
boolean | mkdirs(String path, boolean override) mkdirs boolean _flag = false; File _path = new File(path); if (!_path.exists()) { _path.mkdirs(); _flag = true; } else { if (override) { _flag = true; ... |
boolean | mkdirs(String s) Mkdirs. File f = new File(s); return f.mkdirs(); |
void | mkdirsFor(File destination) mkdirs For if (destination.getParentFile() != null && !destination.getParentFile().exists()) {
destination.getParentFile().mkdirs();
|
boolean | mkdirsIfAbsent(String pathname) Make Directories (including parent directories) if not exist. File file = new File(pathname); if (!file.exists()) { return file.mkdirs(); return true; |
boolean | mkdirsIfNotExists(String pathname) mkdirs If Not Exists File file = new File(pathname); if (!file.isDirectory()) { if (!file.mkdirs()) { System.err.println("fail to create directory: " + pathname); return false; return true; ... |
void | mkdirsifnotExists(String s) Mkdirsifnot exists. if (s == null) { return; File f = new File(s); if (!f.exists()) { f.mkdirs(); |
void | mkdirsInRemote(String host, String path, boolean deleteIfExisted) mkdirs In Remote if (deleteIfExisted) deleteInRemote(host, path); if (!runCommandInRemoteHost(host, "mkdir -p " + path, 0).isEmpty()) throw new IOException("fail to delete " + host + ":" + path); |
void | mkdirsOrCrash(File d) mkdirs Or Crash if (!d.exists()) d.mkdirs(); if (!d.isDirectory()) throw new RuntimeException("\"" + d.getAbsolutePath() + "\" must be a directory. Aborting."); |
void | mkdirsOrFail(File dirFile) Check if given file is directory and try to create it if not. if (dirFile == null) { return; if (!dirFile.isDirectory()) { if (!dirFile.mkdirs()) { throw new IOException( "Directory doesn't exist and its creation failed: " + dirFile.getAbsolutePath()); |
boolean | mkdirsWithExistsCheck(File dir) mkdirs With Exists Check if (dir.mkdir() || dir.exists()) { return true; File canonDir = null; try { canonDir = dir.getCanonicalFile(); } catch (IOException e) { return false; ... |