Unknown level in directory, fetch the name of directory with .java file in it

132 views Asked by At

How to access the directory name where I only know it contain .java files and level of directory keep on changing. so is their any way in ANT Script to access those directories with particular .java files in it.

I am using below Script:

<target name="check">
<for param="check1">
    <path>
        <dirset dir="${project_path}/adapters" includes="*/src/*.java"/>
    </path>
    <sequential>
    <echo>@{check1}</echo>
</sequential>
</for>
</target>

Result:

It is giving nothing as output because it is searching .java file inside src folder but .java files are present under multilevel directories of src. I am not getting how to do it.

1

There are 1 answers

2
JP Moresmau On

As the ant fileset doc states (https://ant.apache.org/manual/Types/fileset.html) you can use ** to search recursively into directories.

<dirset dir="${project_path}/adapters" includes="*/src/**/*.java"/>