Android Directory Create createDir(String path)

Here you can find the source of createDir(String path)

Description

Creates a new directory on the machine's filesystem

License

Open Source License

Parameter

Parameter Description
path Directory to create

Declaration

public static void createDir(String path) 

Method Source Code

//License from project: Open Source License 

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import com.haxademic.core.app.P;
import com.haxademic.core.debug.DebugUtil;
import com.haxademic.core.math.MathUtil;

public class Main{
    /**//from  www.j a v a2 s. c om
     * Creates a new directory on the machine's filesystem
     * @param path Directory to create
     */
    public static void createDir(String path) {
        File f = new File(path);
        try {
            if (f.mkdir()) {
                P.println("Directory created: " + path);
            } else {
                P.println("Directory was not created" + path);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related

  1. createDir(String dir, boolean ignoreIfExitst)
  2. createDir(String dirName)
  3. createDir(String directory)
  4. createDir(final File path)
  5. createDirIfNotExists(File d)
  6. createDirIfNotExists(String d)
  7. createDirStructureForFile(File file)