List of utility methods to do Directory Create
void | createDir(String dir, boolean ignoreIfExitst) create Dir File file = new File(dir); if (ignoreIfExitst && file.exists()) { return; if (file.mkdir() == false) { throw new IOException("Cannot create the directory = " + dir); |
boolean | createDir(String dirName) create Dir File file = new File(dirName); if (!file.exists()) return file.mkdir(); return true; |
boolean | createDir(String directory) creates the directory passed in, creating any parents as needed. File f = new File(directory); if (f.exists()) { return true; } else { return f.mkdirs(); |
void | createDir(String path) Creates a new directory on the machine's filesystem File f = new File(path); try { if (f.mkdir()) { P.println("Directory created: " + path); } else { P.println("Directory was not created" + path); } catch (Exception e) { ... |
boolean | createDir(final File path) Makes a directory, including any necessary but nonexistent parent directories. boolean isSuccess = false; if (path != null) { try { org.apache.commons.io.FileUtils.forceMkdir(path); isSuccess = true; } catch (IOException e) { logger.warn(e, e); } else { logger.warn("Oops!.. Path is null!"); return isSuccess; |
void | createDirIfNotExists(File d) create Dir If Not Exists if (d.exists()) { verifyIsDir(d); return; boolean created = d.mkdirs(); if (!created) throw new IllegalStateException("Could not create directory " + d); ... |
void | createDirIfNotExists(String d) create Dir If Not Exists createDirIfNotExists(new File(d));
|
void | createDirStructureForFile(File file) create Dir Structure For File if (!file.exists()) { String[] dirs = file.getAbsolutePath().split(File.separator); String newFile = ""; for (int index = 0; index < dirs.length - 1; index++) newFile += "/" + dirs[index]; File currFile = new File(newFile); if (!currFile.exists()) if (!currFile.mkdirs()) ... |
void | createDirs(String dir, boolean ignoreIfExitst) create Dirs File file = new File(dir); if (ignoreIfExitst && file.exists()) { return; if (file.mkdirs() == false) { throw new IOException("Cannot create directories = " + dir); |
void | createDirsForFile(File file) Create directories for file if they do not exist. File dir = file.getParentFile();
if (dir != null) {
directory(dir);
|