ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Ant- copy file from one folder to many folders
Date Mon, 29 Dec 2008 05:09:46 GMT
The standard <copy> task requires a single target name, so you
couldn't do it with the standard Ant tasks. However, there is a
special addition to Ant called the AntContrib tasks
<http://ant-contrib.sourceforge.net/>. These extend Ant to allow for
all sorts of tricks.

There's one special AntContrib task called <foreach>
<http://ant-contrib.sourceforge.net/tasks/tasks/foreach.html>. This
will allow you to go through each directory in a list, and use that as
the "todir" parameter of a copy task. It'll look something like this:

<target name="orig">
    <foreach
        target="copyclass"
        parameter="copy.target">
        <path>
             <dirset dir="myfolder*/**"/>
        </path>
    </foreach>
</target>

<target name="copy">
    <copy todir="${copy.target}"
        file="myclass.class"/>
</target>

READ THE COMPLETE DOCUMENTATION ON THE ANT-CONTRIB PACKAGE! You must
download the AntContrib JAR file, put it in your Ant's "lib"
directory, and add a <taskdef> task to your build.xml file.

On Sun, Dec 28, 2008 at 10:37 AM, Alexei Alexei <a_subscriber@mail.ru> wrote:
> Hi!
> I have file "myclass.class" in the next folders:
>
> -myfolder1
> -myfolder2
> -myfolder2/test
> -myfolder2/test/test2
> -myfolder2/test3
>
> I need to copy "myclass.class" from "myfolder1" to the folder "myfolder2" and all it's
subfolders. How I can do this with Ant
>
>
>
>
> Новый Mail.Ru Агент с Аськой!
> http://r.mail.ru/cln4786/agent.mail.ru/ru/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com
Mime
View raw message