ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Resnick" <abune...@gmail.com>
Subject Not filtering during copy when <modified> used (was RE: Making copy NEVER overwrite)
Date Mon, 28 Mar 2005 06:27:54 GMT
-v and -debug both say that the file is being copied.

>From verbose output:

     [copy] auto2.vcp added as auto2.vcp.bak doesn't exist.
     [copy] Copying 1 file to D:\proj
     [copy] Copying D:\proj\auto2.vcp to D:\proj\auto2.vcp.bak
     [copy] Copying 1 file to D:\proj
     [copy] Copying D:\proj\auto2.vcp.bak to D:\proj\auto2.vcp

One minor correction to what I wrote before, the overwrite attribute is
present along with the modified element.

The filtering doesn't happen when I have the modified element in the copy
operation. 

I've seen that there is no debug output when the filtering works, so it's
hard to say why it is not happening.

-David

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Wednesday, March 23, 2005 10:21
To: user@ant.apache.org
Subject: AW: AW: Making copy NEVER overwrite

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:abunetta@gmail.com]
> 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:antoine@gmx.de] 
> 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:abunetta@gmail.com]
> > > 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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


Mime
View raw message