Java mkdir makeDirectory(String directoryName)

Here you can find the source of makeDirectory(String directoryName)

Description

Creates a directory given a directory name.

License

Open Source License

Parameter

Parameter Description
directoryName the name of the directory

Declaration

public static void makeDirectory(String directoryName) 

Method Source Code

//package com.java2s;
/*/*from w  w  w.  j a va2 s .c  om*/
 * Copyright (c) 2013, Miguel Martins
 * Use is subject to license terms.
 *
 * This source code file is provided under the MIT License. Full licensing
 * terms should be available in the form of text files. The standard source code
 * distribution provides a LICENSE.txt file which can be consulted for licensing
 * details.
 */

import java.io.File;

public class Main {
    /**
     * Creates a directory given a directory name. If the corresponding
     * directory already exists, nothing happens.
     *
     * @param directoryName the name of the directory
     * @see File#mkdir()
     */
    public static void makeDirectory(String directoryName) {
        File directory = new File(directoryName);
        if (!directory.exists()) {
            boolean directoryCreated = directory.mkdir();
            assert directoryCreated : "Could not create output directory!";
        }
    }
}

Related

  1. makedirectory(File outputDirectory, String directoryName)
  2. makeDirectory(File testDir )
  3. makeDirectory(final CharSequence aPath)
  4. makeDirectory(final File file, final String extension)
  5. makeDirectory(String directory)
  6. makeDirectory(String directoryPath)
  7. makeDirectory(String dirPath)
  8. MakeDirectory(String name)
  9. makeDirectory(String name)