ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Priest <>
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="*/**"/>

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

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

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


<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 -->        

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

-----Original Message-----
From: Wascally Wabbit []
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

The Wabbit 

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message