List of utility methods to do Directory Create
String | getDir(String path) Returns the absolute path of the given directory. File f = null; if (path.startsWith(Character.toString(File.separatorChar))) { f = new File(path); } else { f = new File(".", path); return f.getCanonicalPath(); |
boolean | isParentDirectoryCreationRequired(File file) is Parent Directory Creation Required File parent = file.getParentFile(); if (parent != null && !parent.exists()) { return true; } else { return false; |
String | join(String dir, String subDir) join dir = ensureSlash(dir); if (subDir.startsWith(File.separator)) { subDir = subDir.substring(1); return dir + subDir; |
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 | makehome(String home) create a directory File homedir = new File(home); if (!homedir.exists()) { try { homedir.mkdirs(); } catch (Exception ex) { throw new Exception("Can not mkdir :" + home + " Maybe include special charactor!"); |
boolean | mkDir(String dirName) mk Dir File file = new File(dirName); return !StringUtil.isBlank(dirName) && file.mkdir(); |
boolean | mkDir(String path) mk Dir File file = new File(path); if (!file.exists()) { if (!file.mkdirs()) { return false; return true; |
File | mkdir(File path) Creates the directories in the specified path. assertNotNull("path", path); if (path.mkdirs()) { LOGGER.trace.log("Created directory: ", path.getPath()); return path; |
void | mkdir(String filePath) mkdir StringBuffer path = new StringBuffer(); String[] fileList = filePath.split("/"); path.append(fileList[0]); File rootfile = new File(path.toString()); rootfile.mkdir(); for (int i = 1; i < fileList.length; i++) { path.append("/").append(fileList[i]); File file = new File(path.toString()); ... |
String | mkdir(String path) Creates the directories in the specified path. mkdir(new File(path = assertNotEmpty("path", path))); return path; |