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:edu.uci.ics.asterix.drivers.AsterixCLI.java

public static void setUp(Options options) throws Exception {
    System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, options.properties);
    File outdir = new File(options.outputFolder);
    outdir.mkdirs();

    File log = new File("asterix_logs");
    if (log.exists())
        FileUtils.deleteDirectory(log);/*ww w.ja  v  a2s.c o m*/
    File lsn = new File("last_checkpoint_lsn");
    lsn.deleteOnExit();

    AsterixHyracksIntegrationUtil.init();
}

From source file:Main.java

public static File createFile(String folderPath, String fileName) {
    File destDir = new File(folderPath);
    if (!destDir.exists()) {
        destDir.mkdirs();
    }//from  ww w  .ja  va2  s .c  om
    return new File(folderPath, fileName + fileName);
}

From source file:Main.java

private static File createDirectory(String path) {

    File f = new File(path);

    if (!f.exists()) {
        if (!f.mkdirs()) {
            return null;
        }//from w w w. j  a va 2 s .c o  m
    }

    return f;

}

From source file:Main.java

private static void salvarNoDisco(BufferedImage fotoSalvar, String nomeFoto) throws IOException {
    File f = new File(FOLDER);

    if (!f.exists()) {
        f.mkdirs();
        f.setReadable(true);//from w w w.  ja v  a2 s  . c  om
        f.setWritable(true);
    }

    ImageIO.write(fotoSalvar, "png", new File(FOLDER + nomeFoto));
}

From source file:Main.java

public static boolean createDir(String fileFolder) {
    File dir = new File(fileFolder);
    if (!dir.exists()) {
        return dir.mkdirs();
    }//  w  w w.  ja va  2  s.c o m
    return false;
}

From source file:Main.java

private static void dirChecker(String rootDir, String dir) {
    File f = new File(rootDir + "/" + dir);
    if (!f.isDirectory()) {
        f.mkdirs();
    }/*from  ww w. j  ava2s .  c  om*/
}

From source file:Main.java

public static boolean mkFiledir(String filePath) {
    File file = new File(filePath);
    if (!file.exists()) {
        return file.mkdirs();
    }//  www.j  av a 2 s  .  c o  m
    return false;
}

From source file:classes.Upload.java

public static String uploadImage(HttpServletRequest request, ServletConfig config, String path)
        throws FileUploadException, Exception {
    String url = "";
    String imgDir = config.getServletContext().getRealPath(path) + "/";
    File dir = new File(imgDir);
    dir.mkdirs();
    System.out.println("PasaPorAqui2");
    DiskFileItemFactory fabrica = new DiskFileItemFactory();
    fabrica.setSizeThreshold(1024);/*from w w w  . jav  a 2  s .co  m*/
    fabrica.setRepository(dir);

    ServletFileUpload upload = new ServletFileUpload(fabrica);
    List<FileItem> partes = upload.parseRequest(request);

    for (FileItem item : partes) {
        System.out.println("Subiendo");
        File archivo = new File(imgDir, item.getName());
        item.write(archivo);
        url = item.getName();
    }
    return url;
}

From source file:Main.java

public static void CreateCustomFolderForLanguage() {
    File direct = new File(Environment.getExternalStorageDirectory() + "/WFP/Language/");

    if (!direct.exists()) {
        if (direct.mkdir()) {
            File languageFolder = new File("/WFP/Language/");
            languageFolder.mkdirs();
        }/*from   w  w w . ja  v a2s . com*/

    } else {

    }

}

From source file:com.mirth.connect.util.AttachmentUtil.java

public static void writeToFile(String filePath, Attachment attachment, boolean binary) throws IOException {
    File file = new File(filePath);
    if (!file.canWrite()) {
        String dirName = file.getPath();
        int i = dirName.lastIndexOf(File.separator);
        if (i > -1) {
            dirName = dirName.substring(0, i);
            File dir = new File(dirName);
            dir.mkdirs();
        }/*from   w ww. j  av a2  s .  c  o  m*/
        file.createNewFile();
    }

    if (attachment != null && StringUtils.isNotEmpty(filePath)) {
        FileUtils.writeByteArrayToFile(file,
                binary ? Base64Util.decodeBase64(attachment.getContent()) : attachment.getContent());
    }
}