时间:2020-10-26 23:18:46 | 栏目:JAVA代码 | 点击:次
实例如下所示:
/**
* 创建多级目录文件
*
* @param path 文件路径
* @throws IOException
*/
private void createFile(String path) throws IOException {
if (StringUtils.isNotEmpty(path)) {
File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
file.createNewFile();
}
}