1
votes

I have a folder with some .zip files, and each of it has the same file names. It is possible to unzip them all with apache ant, edit some particular file and to zip it back? Tried to unzip like this

<unzip dest = "temp">
    <fileset dir="${basedir}/libs">
        <include name="*.prpt" />
    </fileset>
</unzip>

The problem is that i can't reference a file from fileset, additional it overrides each other.

1
Do you have *.prpt files in ${basedir}/bmo directory - Keerthivasan
yes... .prpt it's a zip-like archive - Ion C
what is it? .prpt file? I think ant unzip task can really unzip only these file types - zip,war and jar. Can you try changing the file extension and try? - Keerthivasan
i tried to unzip a .prpt file... it's working... doesn't matter... give me a hint how to do this with .zip files. - Ion C
I couldn't understand it clearly - 'The problem is that i can't reference a file from fileset, additional it overrides each other.' - Keerthivasan

1 Answers

2
votes

I am not sure if this is what you expect, because your question is slightly confusing, I am guessing it.

<target name="find.zips">
<foreach target="unpack.zip" param="foreach.zip" inheritall="true">
    <fileset dir="${basedir}" includes="*.prpt"/>
</foreach>
</target>
<target name="unpack.zip">
  <script language="javascript">
           <![CDATA[
               name = project.getProperty("foreach.zip");
               index = name.lastIndexOf(".prpt");
               zipname = name.substring(index+1);
               project.setProperty("foreach.zipname",zipname);
          ]]>
       </script>
  <unzip src="${foreach.zip}" dest="tmp/zipsrc/${foreach.zipname}/"/>
</target>

hope it helps. cheers.