ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Priest <Robert.Pri...@bentley.com>
Subject RE: For Loop
Date Tue, 25 Nov 2003 19:36:50 GMT
I have something that works over directories. I think you just need to
modify the path elements to work for files. It goes like this ( I am
building cab files):

<target name="buildallcabs" depends="init">

 <!-- build language-specific cabs -->
    <path id="langdirs">
        <dirset dir="${NATIVE_SOURCE}PWFileTransfer/PWFileTransferRsrc/rc/">
            <include name="*/**"/>
        </dirset>
    </path>

    <pathconvert pathsep=" " property="temp" refid="langdirs"/>

    <echo message="DIRS: ${temp} "/>

    <foreach param="languageDir" target="buildcab" inheritall="true"
inheritrefs="true">
        <path refid="langdirs"/>
    </foreach>

</target>


<target name="buildcab">

        <basename property="temp.dirname" file="${languageDir}"/>

        <property name="currentLang" value=
"PWFileTransferRsrc${temp.dirname}" />

        <echo message="BUILDING CAB: ${currentLang}"/>

        <!-- do work for individual dirs\files here -->        
</target>


the target="buildallcabs" calls the target="buildcab" for each directory it
finds from the <path> element.


-----Original Message-----
From: Wascally Wabbit [mailto:wascallywabbit@earthling.net]
Sent: Tuesday, November 25, 2003 2:13 PM
To: Ant Users List
Subject: Re: For Loop



At 05:03 PM 11/24/2003, you wrote:
>How do I carry out a loop for a group of variables?  I want to carry out a 
>task for each file in a directory.
>


You can use the "callforeach" task from http://www.antxtras.info
package.

The Wabbit 



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

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


Mime
View raw message