删除文件及文件夹
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
删除文件,及文件夹
String appUrl = "/lyg/app/20171128/20001/wanju.apk" ;
File oldFile = new File(appUrl);
if (oldFile.exists() && oldFile.isFile()) {
oldFile.delete();
int lastIndexOf = appUrl.lastIndexOf( "/" );
appUrl = appUrl.substring( 0 ,lastIndexOf);
File fileDir = new File(appUrl);
if (fileDir.isDirectory()){
fileDir.delete();
}
}
|
删除文件工具类,扩展:
https://www.cnblogs.com/esther-qing/p/6145336.html
本文转自建波李 51CTO博客,原文链接:http://blog.51cto.com/jianboli/2045375,如需转载请自行联系原作者