javaでディレクトリを作成する方法

javaコード

static public void createFolder(String filepath) {
if (filepath.lastIndexOf(File.separator)>-1) {
String folderpath = filepath.substring(0,filepath.lastIndexOf(File.separator));
File dir = new File(folderpath);
if (! dir.exists()) {
dir.mkdirs();
}
} else if (filepath.lastIndexOf(“/")>-1) {
String folderpath = filepath.substring(0,filepath.lastIndexOf(“/"));
File dir = new File(folderpath);
if (! dir.exists()) {
dir.mkdirs();
}
} else if (filepath.lastIndexOf(“\\")>-1) {
String folderpath = filepath.substring(0,filepath.lastIndexOf(“\\"));
File dir = new File(folderpath);
if (! dir.exists()) {
dir.mkdirs();
}
}
}

Java

Posted by arkgame