Java Create Directory mkDir(String fullPath, String directoryPath)

Here you can find the source of mkDir(String fullPath, String directoryPath)

Description

mk Dir

License

LGPL

Declaration

private static void mkDir(String fullPath, String directoryPath) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.File;

public class Main {
    private static void mkDir(String fullPath, String directoryPath) {
        String[] dirctories = directoryPath.split("/");
        if (dirctories == null || dirctories.length <= 1) {
            return;
        }//from  w w w . j a v a2 s  .  c  o  m
        File directory = new File(
                fullPath.substring(0, fullPath.indexOf("/" + dirctories[0] + "/") + dirctories[0].length() + 1));
        //      log.info(directory);
        if (!directory.exists()) {
            directory.mkdir();
        } else if (!directory.isDirectory()) {
            directory.delete();
            directory.mkdir();
        }
        int index = directoryPath.indexOf("/");
        String dirctoryStr = index != -1 ? directoryPath.substring(index + 1, directoryPath.length()) : "";
        mkDir(fullPath, dirctoryStr);
    }
}

Related

  1. mkdir(String dirPath, boolean del)
  2. mkdir(String dname)
  3. mkdir(String folder)
  4. mkdir(String folderName, long lastModifiedDate)
  5. mkdir(String folderpath)
  6. mkdir(String mkdirName)
  7. mkdir(String name)
  8. mkdir(String name)
  9. mkdir(String name, File dir)