There are three steps in one <copy> statements:
1. select all files for the copy operation (<fileset>,<modified>)
   - select all files which suffix is ".vcp.bak"
   - check by their absolute pathname a stored MD5-hashvalue
   - if the new computed hashvalue is not equal to the stored
   --> that file goes to step 2
2. copy files to destdir
3. filtering

Are you sure, that files are copied?
What does -verbose / -debug say?


Jan

> -----Ursprüngliche Nachricht-----
> Von: David Resnick [mailto:[EMAIL PROTECTED]
> Gesendet am: Mittwoch, 23. März 2005 07:30
> An: 'Ant Users List'
> Betreff: RE: AW: Making copy NEVER overwrite
> 
> 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
> back!
> 
> 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"/>
>   </present>
>  </fileset>
> </copy>
> <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}/cache.properties"/>
>    </modified>
>   </fileset>
>   <filterchain>
>    <tokenfilter>
>     <replaceregex pattern="(.*)/YX(.*)" replace="\1\2" flags="gi"/>
>     <replaceregex pattern="(.*)/FR(.*)" replace="\1\2" flags="gi"/>
>    </tokenfilter>
>  </filterchain>
> </copy>
> 
> 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 [mailto:[EMAIL PROTECTED] 
> 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
> <copy>
>   <not>
>     <present ..../>
>   </not>
> </copy>
> Cheers,
> Antoine
> > set the read-only flag to the files?
> > 
> > Jan
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: David Resnick [mailto:[EMAIL PROTECTED]
> > > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to