I want to execute a command from an Ant buildfile, for each file in a directory.
I am looking for a platform-independent solution.
How do I do this?
Sure, I could write a script in some scripting language, but this would add further dependencies to the project.
Use the <apply> task.
It executes a command once for each file. Specify the files by means of filesets or any other resource. <apply> is built-in; no additional dependency needed; no custom task implementation needed.
It's also possible to run the command only once, appending all files as arguments in one go. Use the parallel attribute to switch the behaviour.
Sorry for being late a year.