String path = "E:/test";
String name = "helloword.doc";
File name_Path = new File(path,name);
name_Path.getParentFile().mkdirs();
先查看文件夹是否存在,不存在则创建文件夹
if (!name_Path.exists()) {
name_Path.createNewFile();
}
直接在指定的文件夹下面创建了此文件
String path = "E:/test";
String name = "helloword.doc";
File name_Path = new File(path,name);
name_Path.getParentFile().mkdirs();
先查看文件夹是否存在,不存在则创建文件夹
if (!name_Path.exists()) {
name_Path.createNewFile();
}
直接在指定的文件夹下面创建了此文件
转载于:https://my.oschina.net/meSpace/blog/98648