Android Utililty Methods Directory Create

List of utility methods to do Directory Create

Description

The list of methods to do Directory Create are organized into topic(s).

Method

StringgetDir(String path)
Returns the absolute path of the given directory.
File f = null;
if (path.startsWith(Character.toString(File.separatorChar))) {
    f = new File(path);
} else {
    f = new File(".", path);
return f.getCanonicalPath();
booleanisParentDirectoryCreationRequired(File file)
is Parent Directory Creation Required
File parent = file.getParentFile();
if (parent != null && !parent.exists()) {
    return true;
} else {
    return false;
Stringjoin(String dir, String subDir)
join
dir = ensureSlash(dir);
if (subDir.startsWith(File.separator)) {
    subDir = subDir.substring(1);
return dir + subDir;
booleanmakeDirs(File f)
Make a directory and its parents, returning true if and only if the dir exists.
if (f.exists()) {
    if (!f.isDirectory()) {
        return false;
    return true;
return f.mkdirs();
voidmakehome(String home)
create a directory
File homedir = new File(home);
if (!homedir.exists()) {
    try {
        homedir.mkdirs();
    } catch (Exception ex) {
        throw new Exception("Can not mkdir :" + home
                + " Maybe include special charactor!");
booleanmkDir(String dirName)
mk Dir
File file = new File(dirName);
return !StringUtil.isBlank(dirName) && file.mkdir();
booleanmkDir(String path)
mk Dir
File file = new File(path);
if (!file.exists()) {
    if (!file.mkdirs()) {
        return false;
return true;
Filemkdir(File path)
Creates the directories in the specified path.
assertNotNull("path", path);
if (path.mkdirs()) {
    LOGGER.trace.log("Created directory: ", path.getPath());
return path;
voidmkdir(String filePath)
mkdir
StringBuffer path = new StringBuffer();
String[] fileList = filePath.split("/");
path.append(fileList[0]);
File rootfile = new File(path.toString());
rootfile.mkdir();
for (int i = 1; i < fileList.length; i++) {
    path.append("/").append(fileList[i]);
    File file = new File(path.toString());
...
Stringmkdir(String path)
Creates the directories in the specified path.
mkdir(new File(path = assertNotEmpty("path", path)));
return path;