| | |
| | | * 添加目录文件 |
| | | */ |
| | | private void addFolderFile(int i, String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception { |
| | | File file = new File(uploadPath + File.separator + mf.getPath()); |
| | | if (!file.exists() || !file.isDirectory()) { |
| | | return; |
| | | } |
| | | zip.addFolder(file, params); |
| | | |
| | | String fileName = FileHelper.getFileName(file.getPath()); |
| | | FileHeader header = zip.getFileHeader(fileName); |
| | | if (null != header) { |
| | | zip.renameFile(header, i + "_" + mf.getName()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | for (String ext : extList) { |
| | | File file = new File(uploadPath + File.separator + mf.getPath().replace("." + mf.getType(), ext)); |
| | | if (!file.exists() || !file.isDirectory()) { |
| | | if (!file.exists() || file.isDirectory()) { |
| | | continue; |
| | | } |
| | | zip.addFile(file, params); |