Java mkdir makeDirectory(File file)

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

Description

Creates directories if not exists.

License

Apache License

Parameter

Parameter Description
file a parameter

Exception

Parameter Description
IOException If it failed to create directories

Declaration

public static void makeDirectory(File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    /**//  www .j  a  v  a  2  s. c  om
     * Creates directories if not exists.
     * @param file
     * @throws IOException If it failed to create directories
     */
    public static void makeDirectory(File file) throws IOException {
        if (!file.isDirectory()) {
            if (!file.mkdirs() || !file.isDirectory()) {
                throw new IOException("can't make directory: " + file);
            }
        }
    }
}

Related

  1. makeDirectories(JarFile jar, String eviwareDir)
  2. makeDirectories(String path)
  3. makeDirectories(String path)
  4. makeDirectory(File dir)
  5. makeDirectory(File directory)
  6. makeDirectory(File file)
  7. makeDirectory(File file)
  8. makedirectory(File outputDirectory, String directoryName)
  9. makeDirectory(File testDir )