You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Alexander Ziller <al...@highqsoft.de> on 2009/10/12 11:47:44 UTC

Using on FileSets

Hey there

Im desperatly trying to get an intersection of 2 directories but it doesn't
work.

The situation:
--------------

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...

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>


Problem:
Nothing get copied :-(

Thanks for your help.

Alex




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


Re: Using on FileSets

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-10-12, Alexander Ziller <al...@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