ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Resnick" <>
Subject RE: AW: Making copy NEVER overwrite
Date Wed, 23 Mar 2005 06:30:12 GMT
I think I have the solution in my grasp (thanks to the great suggestions of
using <modified> and <present>), but I still need some help.

I've added <present> to the original copy task and <modified> to the
filtering back copy task. It now seems to only copy when I want it to: it
backs up the files without overwriting the backup if it exists, and it
copies the files back just once. 

The problem now is that it doesn't do the filtering when it copies the files

This is what I have:

<copy todir="${__root}" preservelastmodified="true">
 <mapper type="glob" from="*" to="*.bak"/>
 <fileset dir="${__root}" includes="**/*.vcp" casesensitive="false">
  <present targetdir="${__root}" present="srconly">
   <mapper type="glob" from="*" to="*.bak"/>
<copy todir="${__root}">
 <mapper type="glob" from="*.bak" to="*"/>
  <fileset dir="${__root}" includes="**/*.vcp.bak" casesensitive="false">
   <modified cache="propertyfile">
	<param name="cache.cachefile" value="${dir.scm}/"/>
    <replaceregex pattern="(.*)/YX(.*)" replace="\1\2" flags="gi"/>
    <replaceregex pattern="(.*)/FR(.*)" replace="\1\2" flags="gi"/>

If I remove the <modified> and add an overwrite attribute, the filtering
works (though it recopies each time it is run). As it shown above, it
doesn't do the filtering at all.

Any suggestions?

Thanks, David

-----Original Message-----
From: Antoine Levy-Lambert [] 
Sent: Wednesday, March 23, 2005 00:17
To: Ant Users List
Subject: Re: AW: Making copy NEVER overwrite

I would use the <present/> selector 
something like
    <present ..../>
> set the read-only flag to the files?
> Jan
> > -----Ursprüngliche Nachricht-----
> > Von: David Resnick []
> > Gesendet am: Dienstag, 22. März 2005 11:40
> > An: 'Ant Users List'
> > Betreff: Making copy NEVER overwrite
> > 
> > I am making a backup of some files which I then filter back into the
> > original. Unfortunately, because of the way the targets are 
> > set up,  this is
> > done more than once. I want the copy task to perform the 
> > backup only if the
> > backup files don't exist. Setting overwrite to false doesn't 
> > help me because
> > the second time around the original is newer than the backup.
> > 
> >  
> > 
> > Can anyone think of a way of preventing the copy target from 
> > copying if the
> > file already exists?
> > 
> >  
> > 
> > Thanks, David
> > 
> > 

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message