You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nicolas Vervelle <ni...@steria.com> on 2005/09/02 19:03:53 UTC

Comparing two files

Hi,

there's probably a simple way to do it, but I don't know how.

I want to compare two files (see if they have the same contents, 
timestamp can be different) and then if they differ I want to copy an 
other file.
Can someone help me ?

Thanks in advance,
Nicolas


PS: If you need more infos, here's the context and what I need to do.
I have a .pot file that is created by an external tool (xgettext), but 
I want to replace my existing .pot file only if the difference between 
the old and the new file is significative enough (if only comments 
differ, I want to keep the old file)
So, for the moment, I do the following :
- copy the old file to tmp/old.pot with <copy>
- remove non important things in tmp/old.pot with <replaceregexp>
- generate the new .pot file in tmp/my.pot with xgettext
- copy the new file to tmp/new.pot with <copy>
- remove non important things in tmp/new.pot with <replaceregexp>
The last part for which I am asking help: if tmp/old.pot differs from 
tmp/new.pot then replace my.pot with tmp/my.pot


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


Re: Comparing two files

Posted by Juergen Hermann <jh...@web.de>.
On Fri, 02 Sep 2005 19:03:53 +0200, Nicolas Vervelle wrote:

loadfile them into 2 properties and then use a <iseq> condition.

>Hi,

>there's probably a simple way to do it, but I don't know how.

>I want to compare two files (see if they have the same contents, 
>timestamp can be different) and then if they differ I want to copy an 
>other file.
>Can someone help me ?

>Thanks in advance,
>Nicolas


>PS: If you need more infos, here's the context and what I need to do.
>I have a .pot file that is created by an external tool (xgettext), but 
>I want to replace my existing .pot file only if the difference between 
>the old and the new file is significative enough (if only comments 
>differ, I want to keep the old file)
>So, for the moment, I do the following :
>- copy the old file to tmp/old.pot with <copy>
>- remove non important things in tmp/old.pot with <replaceregexp>
>- generate the new .pot file in tmp/my.pot with xgettext
>- copy the new file to tmp/new.pot with <copy>
>- remove non important things in tmp/new.pot with <replaceregexp>
>The last part for which I am asking help: if tmp/old.pot differs from 
>tmp/new.pot then replace my.pot with tmp/my.pot


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



Ciao, Jürgen



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


Re: Comparing two files

Posted by Matt Benson <gu...@yahoo.com>.
--- Nicolas Vervelle <ni...@steria.com>
wrote:

> Hi,
> 
> there's probably a simple way to do it, but I don't
> know how.
> 
> I want to compare two files (see if they have the
> same contents, 
> timestamp can be different) and then if they differ
> I want to copy an 
> other file.
> Can someone help me ?

look for the filesmatch condition here:

http://ant.apache.org/manual/CoreTasks/conditions.html

-Matt


> 
> Thanks in advance,
> Nicolas

[SNIP]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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