版权声明:本文为博主原创文章,http://blog.csdn.net/m0_37039192 https://blog.csdn.net/m0_37039192/article/details/83617936
问题: Android 5.1 创建多级文件夹失败之奇怪的问题
源码:
/**
* 判断文件夹是否创建
*/
private static String foundFolder(String... str){
int length = str.length;
String path = str[0] + "/";
File file = new File(path);
for (int i =1; i < length; i++){
path = path + str[i] + "/";
file = new File(path);
if(!file.exists()){
boolean b = file.mkdir();
if(b){
KLog.i("创建文件夹成功 = " + file.getPath());
}else {
KLog.i("创建文件夹失败 = " + file.getPath());
}
}else {
KLog.i("文件夹已存在 = " + file.getPath());
}
}
return file.getPath();
}
奇因: 创建 /Mdeia/Video 创建这个目录总是创建失败。若是将Video 中的V 改成小写v 就创建成功。不知什么原因