Create a set of files for all files matching the template, with the exception of files with a specific related file

I would like to create a set of files for files matching a specific template, but exclude from this set any files that have another file in the same directory.

For example, I need a set of files that matches all files. /*/file.xml, for example:

<fileset dir="${some.dir}" includes="*/file.xml" /> 

... but I want to exclude any file.xml files that are in the same editor as the ignore.this file.

So, if the structure is dir:

 foo/file.xml bar/file.xml bar/ignore.this 

... file.xml in foo will be selected, but bar will not.

+4
source share
1 answer

You can use a set of files with the present selector using mapper:

 <fileset dir="${some.dir}" includes="*/file.xml"> <present targetdir="${some.dir}" present="srconly"> <mapper type="regexp" from="^(.*)/.*" to="\1/ignore.this" /> </present> </fileset> 

That is, only files with the name file.xml , where there is no corresponding file in the same directory as ignore.this .

+3
source

All Articles