Johnny1am
Johnny1am

Reputation: 11

How do i execute an ant task on files in a specified folder?

I have to preprocess some state machine (.sm) files using a compiler to generate java code before compiling the rest of my project, and using an ant task to do it. At this moment i have to add each file i need to parse manually in the ant target.

How can i use ant to go through a directory i specify and execute the task on all files it finds with .sm extension?

The task needs the filename as a parameter and i don't know how to read that automatically and pass it to the task call.

 <target name="smc-gen" >
        <smc target="java" smfile="${srcPath}/someSmFile.sm" destdir="${ControlPanel.Controller}" smcjar="${smc.jar}" />          
    </target>

Upvotes: 1

Views: 333

Answers (1)

mjn
mjn

Reputation: 36644

The apply task will process all files in the given folder which have a specified extension or name/extension pattern.

Upvotes: 1

Related Questions