mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update
This commit is contained in:
@@ -49,4 +49,33 @@ public class ZipUtil {
|
||||
File zipFileFromImages = ZipUtil.createZipFileFromImages(list);
|
||||
System.out.println(zipFileFromImages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定文件夹下的所有文件
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public static boolean delAllFile(String path) {
|
||||
boolean flag = false;
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
return flag;
|
||||
}
|
||||
if (!file.isDirectory()) {
|
||||
return flag;
|
||||
}
|
||||
String[] tempList = file.list();
|
||||
File temp = null;
|
||||
for (int i = 0; i < tempList.length; i++) {
|
||||
if (path.endsWith(File.separator)) {
|
||||
temp = new File(path + tempList[i]);
|
||||
} else {
|
||||
temp = new File(path + File.separator + tempList[i]);
|
||||
}
|
||||
if (temp.isFile()) {
|
||||
temp.delete();
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user