创建文件夹

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();
   }

直接在指定的文件夹下面创建了此文件

 

你可能感兴趣的:(创建文件夹)