1. Android进阶之路——文件读写 https://www.jianshu.com/p/4c020b45f9e3
2. 文件操作工具类FileUtils https://blog.csdn.net/github_35033182/article/details/53710815
3. 工具类之FileUtils https://www.jianshu.com/p/8eb773f8e552
4. Android开发几种常用工具类 https://blog.csdn.net/dimudan2015/article/details/71158332
5. android_文件操作类FileHelper(超完整) https://blog.csdn.net/taily_duan/article/details/53116322
6. Android编程之文件读写操作与技巧总结【经典收藏】http://www.jb51.net/article/86534.htm
1. mkdir()与mkdirs()的区别:
mkdir()是只能创建一级目录(文件夹),如果这一级目录的上面还有没有创建的目录(文件夹),那么程序会报错。
mkdirs()是可以创建多级目录(文件夹),它是把所有没有的目录(文件夹)都给创建出来。
所以开发中常用mkdirs()来创建目录(文件夹)。
2. Java 在给定路径上创建文件,所在文件夹不存在时,如何正确创建。
String strPath = "E:\\a\\aa\\aaa.txt";
File file = new File(strPath);
File fileParent = file.getParentFile();
if(!fileParent.exists()){
fileParent.mkdirs();
}
file.createNewFile();