Java mkdir makeDirectory(File dir)

Here you can find the source of makeDirectory(File dir)

Description

make Directory

License

Open Source License

Parameter

Parameter Description
dir a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static void makeDirectory(File dir) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.IOException;

public class Main {
    /**/*from   ww  w. ja  v a 2s.com*/
     *
     * @param dir
     * @throws IOException
     */
    public static void makeDirectory(File dir) throws IOException {
        if (dir.exists()) {
            if (!dir.isDirectory()) {
                throw new IOException("File '" + dir + "' is already exist");
            }
        } else {
            if (!dir.mkdirs()) {
                throw new IOException("Cannot create directory '" + dir + "'");
            }
        }
    }
}

Related

  1. makeDirectories(final File file)
  2. makeDirectories(final String location)
  3. makeDirectories(JarFile jar, String eviwareDir)
  4. makeDirectories(String path)
  5. makeDirectories(String path)
  6. makeDirectory(File directory)
  7. makeDirectory(File file)
  8. makeDirectory(File file)
  9. makeDirectory(File file)