I want to compare the contents of two files (say file1.txt,file2.txt) using ANT.
if files content are same then it should set some 'property' to true, if contents are not same then it should set the 'property' as false.
Can anyone suggest me any ANT task that can do this.
Thanks in advance.
I am in the same situation to compare two files and switch into different targets depending on files match or files mismatch...
Heres the code:
The properties are correct and change on changing file contents. the task for nonMatchingVersions never gets started.
You can use something like:
This will set the property only if the files are the same. You can then check for the property, using
This is available in ant, with no added dependency, see here for other conditions.