Java Utililty Methods Create Directory

List of utility methods to do Create Directory

Description

The list of methods to do Create Directory are organized into topic(s).

Method

booleanmkdir(final File file)
mkdir
boolean mkdir = file.mkdir();
handle(mkdir, file);
return mkdir;
booleanmkdir(final String directory)
Creates a directory
File dir = new File(directory);
if (!dir.exists()) {
    return dir.mkdirs();
} else {
    System.out.println("Directory " + directory + " already exists");
return false;
voidmkDir(final String folderPath)
Check if a folder path exists in the file system If not, create it
final File file = new File(folderPath);
if (!file.exists()) {
    file.mkdirs();
voidmkDir(String destDir, String dirName)
mk Dir
File target = new File(destDir + PATH_CHAR + dirName);
if (!target.exists()) {
    if (!target.mkdir())
        throw new RuntimeException("The Directory can't create:" + target.getPath());
booleanmkdir(String dir)
Create a directory, if it does not exist.
if (!exists(dir)) {
    return (new File(dir)).mkdirs();
} else {
    return isDirectory(dir);
Filemkdir(String dir, String file)
mkdir
if (dir == null)
    throw new IllegalArgumentException("dir must be not null");
File result = new File(dir, file);
parnetMkdir(result);
return result;
booleanmkdir(String dir_str)
A simple method that creates a directory if it does not exists.
File dir = new File(dir_str);
if (!dir.exists()) {
    try {
        dir.mkdir();
        return true;
    } catch (SecurityException se) {
        se.printStackTrace();
        return false;
...
voidmkdir(String directory)
Creates a new directory if needed (no exists previously)
File f = new File(directory);
if (!f.exists()) {
    f.mkdir();
booleanmkdir(String directory)
mkdir
if (!(new File(directory)).exists())
    return (new File(directory)).mkdir();
return true;
voidmkdir(String directory)
This method creates the specified directory.
File f = new File(directory);
if (f.exists()) {
    if (f.isFile()) {
        throw new IOException("Error creating directory:" + directory); 
} else {
    if (!f.mkdirs()) {
        throw new IOException("Error creating directory:" + directory); 
...