ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@gmx.de>
Subject Re: compare files from 2 directories
Date Fri, 25 Feb 2011 21:17:14 GMT
If you want to compare two directories using ant, you can do this by 
using the present and the different selectors.

<!-- 1 - find files which are in directory bar but not in foo see [1] -->

<fileset dir="bar" id="onlyinbar">
<not>
<present present="srconly" targetdir="foo"/>
</not>
</fileset>
<echo>these files are only in bar : ${toString:onlyinbar}</echo>

<!-- 2 - find files which exist in both bar and foo but are different -->

<fileset dir="foo" id="differentbarfoo">
     <different targetdir="bar"
         ignoreFileTimes="true"/>
</fileset>

<echo>these files are different in bar compared to foo : 
${toString:differentbarfoo}</echo>

Regards,

Antoine


[1]  http://ant.apache.org/manual/Types/selectors.html#presentselect
[2] http://ant.apache.org/manual/Types/selectors.html#differentselect

On 2/25/2011 10:32 AM, ritchie wrote:
> I want to check files from 2 directories for filematch, I tried using
> checksum task but it does not work for 2 directories. Is it possible to
> attain this by using ant alone?


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


Mime
View raw message