ant - How can I zip each file separately instead of putting in one archive? -


i have 3 files (eg: m1.txt, m2.txt , m3.txt) in /tmp/ folder. how can zip each files m1.zip, m2.zip , m3.zip?

i used following coding, didn't work:

<target name="xzipit">    <foreach target="zipone" param="files">        <path>           <fileset dir="/tmp/" excludes="*.zip"                     includes="*.txt" casesensitive="no" />       </path>    </foreach> </target>  <target name="zipone">    <zip destfile="${files}" basedir="/tmp/">    </zip> </target> 

note use of fileset id, refid usage below , on specifying includesfile zip ant task

    <fileset dir="/tmp" excludes="*.zip"  includes="*.txt" id="zip.fileset.id" casesensitive="no" />      <pathconvert property="zipfilesetprop" refid="zip.fileset.id">         <mapper>             <flattenmapper/>         </mapper>     </pathconvert>      <for list="${zipfilesetprop}" param="filetozip" delimiter=";">         <sequential>             <echo>filetozip @{filetozip}</echo>             <zip destfile="/tmp/@{filetozip}.zip" basedir="/tmp/" includesfile="/tmp/@{filetozip}"/>         </sequential>     </for> 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -