ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Using <intersect> on FileSets
Date Fri, 16 Oct 2009 04:15:54 GMT
On 2009-10-12, Alexander Ziller <alexander.ziller@highqsoft.de> wrote:

> Dir1 contains a set of JARs: a.jar b.jar c.jar d.jar e.jar
> Dir2 contains a subset of the JARs in Dir1: b.jar e.jar
> I want to get the negative intersection (the stuff from Dir1 that's NOT in
> Dir2) and figured
> I tried this with an intersect and then try to invert the result somehow...

The files in Dir1 and Dir2 are different files, at least they have
different paths.  intersect will retain only those resources that are
common in all resource collections and it will not look at the contents
but at the (absolute) names, so when you start from two different
directories (ignoring cases where Dir2 is a subdirectory of Dir1 or the
presence of symlinks) the intersection will always be empty.

I think you want to try the present selector.

<http://ant.apache.org/manual/CoreTypes/selectors.html#presentselect>

> My attempt in ant:

> <copy todir="${root.dir}/intersect">
> 	<intersect>
> 		<fileset dir="Dir1">
> 			<include name="*.jar"/>
> 		</fileset>
> 		<fileset dir="Dri2">
> 			<include name="*.jar"/>
> 		</fileset>
> 	<intersect>
> </copy>

likely is something like

<copy todir="${root.dir}/intersect">
  <fileset dir="Dir1">
    <include name="*.jar"/>
    <present targetdir="Dri2"/>
  </fileset>
</copy>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message