导航

IO在指定目录建文件

Posted on 2022-11-21 19:53  疯狂搬砖人  阅读(29)  评论(0)    收藏  举报
path= "d:\\Project\\log\\log.txt";
File file = new File(path);
//创建文件目录
if(!file.getParentFile().exists()){
    file.getParentFile().mkdirs();//多级
}
file.createNewFile();//创建文件