Java Create Directory mkdir(String name)

Here you can find the source of mkdir(String name)

Description

mkdir

License

Open Source License

Declaration

public static void mkdir(String name) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static void mkdir(String name) {
        String dir_name = "";
        if (name.endsWith(File.separator)) {
            dir_name = name;/*from  w w w .j  av a 2  s.com*/
        } else {
            String s = File.separator;
            if (s.equals("\\")) {
                s = "\\\\";
                name = name.replace("/", "\\");
            }
            String[] tokens = name.split(s);
            if (name.startsWith(File.separator))
                dir_name += File.separator;
            for (int i = 0; i < tokens.length - 1; ++i) {
                dir_name += tokens[i] + File.separator;
            }
        }
        File f = new File(dir_name);
        f.mkdirs();
    }
}

Related

  1. mkdir(String folder)
  2. mkdir(String folderName, long lastModifiedDate)
  3. mkdir(String folderpath)
  4. mkDir(String fullPath, String directoryPath)
  5. mkdir(String mkdirName)
  6. mkdir(String name)
  7. mkdir(String name, File dir)
  8. mkDir(String path)
  9. mkdir(String path)