Java Utililty Methods mkdir

List of utility methods to do mkdir

Description

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

Method

FilemakeDirectory(final File file, final String extension)
make Directory
String name = file.getName();
name = capitalizeFirstLetter(name);
name = name.replace(".gz", "");
name = name.replace(".zip", "");
name = removeExtension(name);
final File dir = new File(file.getParentFile(), name + extension);
dir.mkdir();
return dir;
...
voidmakeDirectory(String directory)
Makes the given directory if it not yet exists.
File dir = new File(directory);
if (!dir.exists())
    dir.mkdir();
else if (!dir.isDirectory())
    System.err.println("'" + directory + "' exists but is not a directory");
voidmakeDirectory(String directoryName)
Creates a directory given a directory name.
File directory = new File(directoryName);
if (!directory.exists()) {
    boolean directoryCreated = directory.mkdir();
    assert directoryCreated : "Could not create output directory!";
booleanmakeDirectory(String directoryPath)
Makes a directory in the given path.
File theDir = new File(directoryPath);
boolean result = false;
if (theDir.exists()) {
    try {
        theDir.delete();
        theDir.mkdir();
        result = true;
    } catch (SecurityException se) {
...
booleanmakeDirectory(String dirPath)
make Directory
boolean isOk = true;
File file = new File(dirPath);
if (!file.exists()) {
    isOk = file.mkdirs();
return isOk;
voidMakeDirectory(String name)
Make Directory
File dir = new File(name);
if (dir.isFile())
    dir.delete();
if (!dir.exists())
    dir.mkdir();
voidmakeDirectory(String name)
Creates a directory relative to codebase, which is typically either the jar or location of the package folders.
File dir = new File(name);
if (dir.isFile())
    dir.delete();
if (!dir.exists())
    dir.mkdir();
voidmakeDirectory(String newDirString)
make Directory
File file = new File(newDirString);
if (!file.exists()) {
    if (file.mkdir()) {
        System.out.println("\ninfo: Directory was created!\n");
    } else {
        System.out.println("\nerror: Failed to create directory!\n");
voidmakeDirectory(String outputDirectory, String directoryName)
make Directory
new File(outputDirectory, directoryName).mkdirs();
booleanmakeDirectory(String path)
make Directory
return new File(path).mkdirs();