开发者

How to get archive name while unzipping

I am using ant unzip task to get contents of a archive file.

Is there a possibility to also save the name of that archive somehow.

Below is the code I am using to unzip an archive.

    <unzip dest="${import.dir}">
        <fileset dir="${tmp.dir}"&g开发者_C百科t;
            <include name="**/*.zip"/>
        </fileset>   
    </unzip>

Regards, Satya


You could use an embedded groovy script

<target name="unzip">
    <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>

    <fileset id="zips" dir="${tmp.dir}" includes="**/*.zip"/>

    <groovy>
        project.references.zips.each { file ->
            ant.echo(message:"message goes here", file:"build.log", append:true)
            ant.unzip(src:file, dest:properties["import.dir"])
        }
    </groovy>
</target>

Groovy task is documented here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜