您的位置:首页 > 其它

自动创建文件(包含没有文件父目录,自动创建)

2015-11-12 09:38 232 查看
@Test
public void test1() throws IOException {
File file = new    File("E:\\app\\1111\\12312\\1212132312.html");
// 如果文件夹不存在则创建
if (!file.getParentFile().exists()&&!file.isDirectory()){
file.getParentFile().mkdirs();
file.createNewFile();
} else {
file.createNewFile();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: