Example usage for java.io File mkdirs

List of usage examples for java.io File mkdirs

Introduction

In this page you can find the example usage for java.io File mkdirs.

Prototype

public boolean mkdirs() 

Source Link

Document

Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.

Usage

From source file:Main.java

private static void _dirChecker(File path, String dir) {
    File f = new File(path, dir);

    if (!f.isDirectory()) {
        f.mkdirs();
    }//w ww  .ja  va 2s .  com
}

From source file:Main.java

public static boolean createDir(String path) {
    File file = new File(path);
    if (!file.exists()) {
        return file.mkdirs();
    }/*from   ww w.ja  va2s .c  om*/
    return false;
}

From source file:Main.java

/** Checks to see if this users temp directory is there
 *  and creates it if it isn't. //  w w  w  .j ava2 s  . c om
 *  @throws IOException if the directory couldn't be created.
 */
private static void checkForTempDirectory() throws IOException {
    File f = new File(tempDirectory);
    if (!f.exists())
        f.mkdirs();
}

From source file:Main.java

public static void ensureDirExists(String dirPath) {
    File dirFile = new File(dirPath);
    if (!dirFile.exists()) {
        dirFile.mkdirs();
    }/*from  w  w w .  jav a 2  s .  c  o  m*/
}

From source file:Main.java

public static File createFolder(String folder) {
    File destDir = new File(folder);
    if (!destDir.exists()) {
        destDir.mkdirs();
    }/*from  ww w  . j av a2 s  . c o  m*/
    return destDir;
}

From source file:cc.kave.commons.utils.exec.run_me.java

private static void cleanDirs(String... dirs) {
    for (String dir : dirs) {
        File f = new File(dir);
        FileUtils.deleteQuietly(f);// w w  w. ja va  2s  . c  o m
        f.mkdirs();
    }
}

From source file:Main.java

public static boolean createFile(File file) {
    if (file.isDirectory()) {
        file.mkdirs();
    } else if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();/*  www  . j  a v a2  s. c  o  m*/
    }
    try {
        file.createNewFile();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return false;
    }

    return true;
}

From source file:Main.java

public static void createFile(String filePath) throws IOException {
    File file = new File(filePath);
    File parent = file.getParentFile();

    if (!parent.exists()) {
        parent.mkdirs();
    }//from  w w w . ja v a  2 s.c  o m
    file.createNewFile();
}

From source file:Main.java

private static String mkdirs(String dir) {
    File file = new File(dir);
    if (!file.exists()) {
        file.mkdirs();
    }/*from w ww .  ja  va  2s  . co m*/
    return dir;
}

From source file:Main.java

private static String getResourcesPath(Context context, String url) {

    String dir = String.format("/Android/data/%s/files/", context.getPackageName());
    File sd = Environment.getExternalStorageDirectory();
    File filePath = new File(sd.getPath() + dir + "savedResources");
    filePath.mkdirs();

    return filePath + url.substring(url.lastIndexOf("/"));
}