创建文件
File file=new File(filePath);
if(!file.exists()){
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
创建文件夹
File file =new File(dirPath);
//如果文件夹不存在则创建
if (!file.exists() && !file.isDirectory()){
System.out.println("目录不存在");
file.mkdir();
} else{
System.out.println("目录存在");
}