我這里包含文件夾的文件不能一步創(chuàng)建完
File file3 =new File("E:\\hello.text\\a.text");
這一句要分成兩步才能創(chuàng)建出來(lái),而且不是文件,而是一個(gè)文件夾。
第一步File file3 =new File("E:\\hello.text");
有了hello.text
File file3 =new File("E:\\hello.text\\a.text");
File file3 =new File("E:\\hello.text\\a.text");
這一句要分成兩步才能創(chuàng)建出來(lái),而且不是文件,而是一個(gè)文件夾。
第一步File file3 =new File("E:\\hello.text");
有了hello.text
File file3 =new File("E:\\hello.text\\a.text");
2016-06-23
舉報(bào)
2016-10-30
File file=new File("D:\\hello.text\\a.text");
if (!file.exists()) {
file.mkdirs();
}
System.out.println("over");
可以一次創(chuàng)建 !如果沒(méi)創(chuàng)建成功,看看 盤(pán)符 等其他問(wèn)題!
2016-10-30
好像你的 file.mkdir 少個(gè)s吧
2016-06-23
有了hello.text文件夾之后才能創(chuàng)建出來(lái)文件夾里面的文件夾。
真是奇怪。
而且\\改為. 之后報(bào)錯(cuò)。