ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Stevens <>
Subject Re: Ant task to unzip files to a dynamic folder
Date Thu, 24 Sep 2009 06:07:01 GMT
2009/9/24 Varman <>:
> Hi all,
> I too have same requirements in which i want extract zip files to different
> folders without using custom codes. This is the code am using. this extracts
> all zip files to "destination_dir" and so files with same name gets
> overwitten (i want to avoid this). For me each zip file has to be extracted
> to different folder inside "destination_dir".
>           <unzip dest="destination_dir">
>                        <fileset dir="source_dir">
>                                <include name="**/*.zip"/>
>                        </fileset>
>            </unzip>
> Can you please give me the solution if you have? I saw a thread already
> posted for this requirement but that was not answered.
> -Arul

Have you tried the ant-contrib for or foreach tasks?
Something like

<for param="file">
                        <fileset dir="source_dir">
                                <include name="**/*.zip"/>
    <propertyregex override="yes"
      property="zipname"  input="@{file}"
      regexp=".*/([^/]*)\.zip" replace="\1"/>
    <mkdir dir="destination_dir/${zipname}"/>
           <unzip dest="destination_dir/${zipname}" src="@{file}"/>


--  open source java sudoku solver

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message