List of utility methods to do Directory Create
void | mkdir(File dir, boolean createDirectoryIfNotExisting) mkdir if (!dir.exists()) { if (!createDirectoryIfNotExisting) { throw new IOException("The directory " + dir.getAbsolutePath() + " does not exist."); if (!dir.mkdirs()) { throw new IOException("Could not create directory " + dir.getAbsolutePath()); if (!dir.isDirectory()) { throw new IOException("File " + dir + " exists and is not a directory. Unable to create directory."); |
File | mkdir(File directory) Makes a directory. if (!directory.mkdir()) throw new IOException("Unable to create directory: " + directory.getPath()); return directory; |
boolean | mkdir(File directory) Create a new directory. if (directory.exists()) { return false; return directory.mkdir(); |
void | mkdir(File directory) Creates the specified directory. if (!directory.exists()) { boolean succeeded = directory.mkdirs(); if (!succeeded) { throw new IllegalStateException( String.format("Error while creating directory: %s", directory.getAbsolutePath())); |
void | mkdir(File dirFile) Create a directory by calling mkdir(); try { boolean bFile = dirFile.exists(); if (bFile == true) { System.err.println("The folder exists."); } else { System.err.println("The folder do not exist,now trying to create a one..."); bFile = dirFile.mkdir(); if (bFile == true) { ... |
void | mkdir(File dirFile) Create a directory by calling mkdir(); System.out.println("Creating the folder: " + dirFile); try { boolean bFile = dirFile.exists(); if (bFile == true) { System.out.println("The folder exists."); } else { System.out.println("The folder do not exist,now trying to create a one..."); bFile = dirFile.mkdir(); ... |
void | mkdir(File f) mkdir if (!f.exists()) {
f.mkdir();
|
void | mkdir(File f) Same as File.mkdirs() exception IOException is thrown on error. if (f.exists() && f.isDirectory()) return; if (!f.mkdirs()) throw new IOException("Cannot mkdir: " + f); |
void | mkDir(File file) mk Dir if (file.getParentFile().exists()) { file.mkdir(); } else { mkDir(file.getParentFile()); file.mkdir(); |
boolean | mkdir(File file) mkdir if (file.exists()) { assertIsDir(file); return false; if (file.mkdirs()) return true; throw new RuntimeException("Failed to create directory '" + file + "'"); |