I have a set of files that I want to run a perl script on. The problem is they are not in the same directory. In fact they are all part of an ordered but complex directory hierarchy.
I wrote a Bash script that does what I want:
if [ ${HOME:+1} ]; then
for A in ${HOME}/a/b/*; do
for B in ${A}/c/*; do
for C in ${B}/*; do
if [ -f $C/somefile ]; then
some_perl_script $C/somefile;
fi
done;
done;
done;
fi
So that works, and it's not too complicated. However, I need that functionality to be available using Ant. Of course I could just call that script from Ant, but I want to know if there is anyway of having Ant do it in the first place, which seems like a more straightforward way of doings things. Essentially, I want something similar to the following build.xml:
<project name="application" basedir=".">
<target name="apply_to_all">
<exec executable="perl" dir="${basedir}">
<arg value="some_perl_script.pl"/>
<arg value="a/b/**/c/**/**/somefile"/>
</exec>
</target>
</project>
I found this SO post. However, I'd like to do it without ant-contrib.