您的位置:首页 > 其它

针对含有多级文件夹时,文件创建

2014-12-17 00:10 190 查看
/多级目录文件创建 /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();
				}



}
当含有多级文件夹时,首先要创建文件夹,判断成功后然后才能创建对应文件夹下的文件。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: