有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何使用ApacheAnt解压多个卷zip文件?

我有一个超过100MB的文件

  • 一些档案。垃圾箱

我使用7z创建了这个文件的多个卷(使用zip格式)。生成的卷如下所示

  • 一些档案。拉链001
  • 一些档案。拉链002

我需要使用ApacheAntV1。9.3解压所有这些卷以恢复原始文件。我尝试了下面的方法,但没有成功

<unzip src="some-archive.zip.001" dest="output-dir"/>

这是ant不支持的东西吗?也就是说,我是否需要编写自己的ant任务来完成此任务


共 (1) 个答案

  1. # 1 楼答案

    假设你已经压缩了一些档案。bin文件,然后拆分一些归档文件。将文件压缩到多个卷中,可以使用concat任务,将二进制设置为true,并指定一个destfile,以便将卷合并回单个压缩文件。然后解压一些档案。用unzip任务压缩

    <target name="merge-and-unzip">
    
      <concat destfile="some-archive.zip" binary="true">
        <fileset dir=".">
          <include name="some-archive.zip.*"/>
        </fileset>
      </concat>
    
      <unzip dest="." src="some-archive.zip"/>
    
    </target>