2011-01-13 8 views
0

ant unzipタスクを使用してアーカイブファイルの内容を取得しています。解凍中にアーカイブ名を取得する方法

そのアーカイブの名前を何らかの形で保存する可能性はありますか?

以下は、アーカイブの解凍に使用しているコードです。

<unzip dest="${import.dir}"> 
     <fileset dir="${tmp.dir}"> 
      <include name="**/*.zip"/> 
     </fileset> 
    </unzip> 

よろしく、 サティヤ

+0

あなたは常にだけ1つのアーカイブに一致する文書化されていますか?または、複数のものと一致する場合はどうなりますか?ログや表示には何が必要なのですか? –

+0

はい、tmp.dirには常に1つのzipしかありません。私はDBにログインするためにそのアーカイブnaeが必要です。 – Satya

答えて

0

あなたが埋め込まれたグルーヴィーなスクリプトを使用することができ

<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のタスクがhere

関連する問題