文档库导入
This commit is contained in:
+7
-2
@@ -37,17 +37,22 @@ public class FileUnZip {
|
|||||||
}
|
}
|
||||||
ZipFile zip = new ZipFile(zipFile,"gbk");
|
ZipFile zip = new ZipFile(zipFile,"gbk");
|
||||||
String orgMkdirs = "";
|
String orgMkdirs = "";
|
||||||
|
int count = 0;
|
||||||
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements(); ) {
|
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements(); ) {
|
||||||
|
count ++;
|
||||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||||
String zipEntryName = entry.getName();
|
String zipEntryName = entry.getName();
|
||||||
String outPath = (descDir + "/" + zipEntryName).replaceAll("\\*", "/");
|
String outPath = (descDir + "/" + zipEntryName).replaceAll("\\*", "/");
|
||||||
|
if(count == 1){
|
||||||
|
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||||
|
}
|
||||||
//判断路径是否存在,不存在则创建文件路径
|
//判断路径是否存在,不存在则创建文件路径
|
||||||
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
}else{
|
}else{
|
||||||
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||||
}
|
}
|
||||||
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
|
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
|
||||||
if (new File(outPath).isDirectory()) {
|
if (new File(outPath).isDirectory()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user