You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2006/01/25 10:55:25 UTC

Comparing direcories / ${toString: ... } ?!

Hi,

yet another file/dir compare question ;-)

i want to check whether two directory listings are equal,
means they contain the same set of files.

i've searched for the subject in the mailing list
archives but didn't find a solution that fits for me.

Now i have a working solution =

<!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" />

<target name="depends">

<fileset dir="T:/testdir1" includes="**/*.*"
id="dir1"defaultexcludes="false" />	
<fileset dir="T:/test/dir2" includes="**/*.*" id="dir2"
defaultexcludes="false"/>
	
<if>
	<equals arg1="${toString:dir1}" arg2="${toString:dir2}"/>
	<then>
		<echo>OK - Dirs are equal !!</echo>
	</then>
	<else>
		<echo>ERROR - Dirs don't match !!</echo>
	</else>
</if>

</target>

Question =

some threads say that ${toString: ... } is a bit experimental,
so it should not be used.

But i like this solution, as it is short.

Is there a better solution ?


bye4now,
Gilbert

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