Java mkdir makeDirs(@Nullable File dir)

Here you can find the source of makeDirs(@Nullable File dir)

Description

Creates dir and its parents

License

Open Source License

Parameter

Parameter Description
dir directory to create, along with any required parent dirs

Exception

Parameter Description
IOException if any of the dirs do not exist and can't be created

Declaration

public static void makeDirs(@Nullable File dir) throws IOException 

Method Source Code


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

import java.io.File;
import java.io.IOException;

import javax.annotation.Nullable;

public class Main {
    /**/*from w  ww  .  j  ava2s.  co  m*/
     * Creates dir and its parents
     * @param dir directory to create, along with any required parent dirs
     * @throws IOException if any of the dirs do not exist and can't be created
     */
    public static void makeDirs(@Nullable File dir) throws IOException {
        if (dir != null && !dir.exists() && !dir.mkdirs()) {
            throw new IOException("unable to create directory (or parents): " + dir);
        }
    }
}

Related

  1. makeDirectory(String sDir)
  2. makeDirectoryWorldAccessible(File directory)
  3. makeDirForPath(String path)
  4. makeDirIfNotExists(File... paths)
  5. makeDirRecursive(File f)
  6. makeDirs(File dir, int numTries)
  7. makeDirs(File f)
  8. makeDirs(File file)
  9. makeDirs(final File file)