Java mkdir makeDirectory(String name)

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

Description

Creates a directory relative to codebase, which is typically either the jar or location of the package folders.

License

Open Source License

Parameter

Parameter Description
name the name of the folder to create

Declaration

public static void makeDirectory(String name) 

Method Source Code

//package com.java2s;
/**/*from   www .  j a v  a  2s .  co  m*/
 *   rscplus
 *
 *   This file is part of rscplus.
 *
 *   rscplus is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   rscplus is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with rscplus.  If not, see <http://www.gnu.org/licenses/>.
 *
 *   Authors: see <https://github.com/OrN/rscplus>
 */

import java.io.File;

public class Main {
    /**
     * Creates a directory relative to codebase, which is typically either the jar or location of the package folders.
     * 
     * @param name the name of the folder to create
     */
    public static void makeDirectory(String name) {
        File dir = new File(name);
        if (dir.isFile())
            dir.delete();
        if (!dir.exists())
            dir.mkdir();
    }
}

Related

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