文档库导入

This commit is contained in:
zhn
2022-06-14 15:47:22 +08:00
parent 464f705fd4
commit 7f476aa021
@@ -37,17 +37,22 @@ public class FileUnZip {
}
ZipFile zip = new ZipFile(zipFile,"gbk");
String orgMkdirs = "";
int count = 0;
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements(); ) {
count ++;
ZipEntry entry = (ZipEntry) entries.nextElement();
String zipEntryName = entry.getName();
String outPath = (descDir + "/" + zipEntryName).replaceAll("\\*", "/");
if(count == 1){
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
}
//判断路径是否存在,不存在则创建文件路径
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
if (!file.exists()) {
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
file.mkdirs();
}else{
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
}
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
if (new File(outPath).isDirectory()) {