ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathieu Champlon <m.champ...@free.fr>
Subject Re: Task processing a DirSet one by one?
Date Mon, 21 Aug 2006 10:12:22 GMT
Chaudhuri, Hiran a écrit :
> Hi there.
>
> I have a directory with several subdirectories. Each subdirectory shall
> be zipped up in its own file.
> As the number of subdirectories can vary, I do not want to code each zip
> task explicitly but rather use a loop with a DirectorySet.
>
> Which Ant task can process a Directory/FileSet and call another task
> (here zip) for each entry found?
>
> directory/subdir1 -> subdir1.zip
> directory/subdir2 -> subdir2.zip
> ...
>   
Hi !

You can use the for/foreach task from ant-contrib with a dirset.
(see http://ant-contrib.sourceforge.net/tasks/tasks/index.html)

Something like :

<for param="subdir">
  <dirset dir="directory" includes="*"/>
  <sequential>
    <zip destfile="@{subdir}.zip">
      <fileset dir="directory" includes="@{subdir}/**"/>
    </zip>
  </sequential>
</for>

(Sorry for any typo :p)

MAT.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message