File操作:
public class Test{
public static void main(String[] args) throws IOException{
File file = new File("d:"+File.separator+"asd"+File.separator+"as"+File.separator+"a.txt");
if(!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if(file.exists()) {
file.delete();
}else {
file.createNewFile();
}
}
}