/多级目录文件创建 /storage/sdcard0/security/upadte/new.apk
File file = new File(filePath);
//createFolderandFile(file);
//创建多级文件夹
File Folder = new File(filePath.substring(0,filePath.lastIndexOf("/")+1));
boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
<span style="white-space:pre"> </span>
<span style="white-space:pre"> </span> if(!sdCardExist) {
<pre name="code" class="java"><span style="white-space:pre"> </span>if(!Folder.exists()){
Folder.mkdirs();
}
if(!file.exists())
{
file.exists();
}
}
当含有多级文件夹时,首先要创建文件夹,判断成功后然后才能创建对应文件夹下的文件。