I want to include files in an existing zip file using <zip> task, based on a specific criterion.

 

If I include the condition with in the <zip> task, it is not supported. I’ve written a separate target that includes files in the zip.

 

Every time this target is called, it overwrites the zip file and creates new one.

 

Here is the code for the two targets I’m using:

 

<target name="include-db-full">

            <foreach item="File" property="filename">

                        <in>

                              <items>

                                    <include name="${build.path}\**\*.sql"/>

                              </items>

                        </in>

                        <do>

                              <if test = "${string::contains(filename, 'full')== true}" >

                                    <echo message = "${filename}"/>

                                    <call target="include-sql-in-package"/>

                              </if>

                        </do>

            </foreach>

      </target>

     

      <target name="include-sql-in-package">

            <zip zipfile="${build.zipfile}" ziplevel="9">  

                  <fileset basedir="${build.path}">

                        <include name="${filename}"/>

                  </fileset>

            </zip>

      </target>

 

Any pointers to resolve the same will be helpful.

 

Thanks

Shelly

 

Reply via email to