ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Huditsch Roman" <Roman.Hudit...@lexisnexis.at>
Subject Copiing newer files to a directory [was: using file names]
Date Wed, 13 Apr 2005 12:01:58 GMT
Hi,

Thanks for the snippet!
I found out that <var name="nameOfProperty" unset="true"/> you can reset a property.


What I want to do is quite simple (although unachievable for me):

I would like to copy all files from a directory "source", which are newer to those in "result",
to an own directory "input".
So, source/a.xml needs to be compared to result/a.xml
source/b.xml to result/b.xml and so on....

At the end, the "input" directory should just hold  the new files...

I don't know how to do this....

Thanks very much for any help....

kind regards,
Roman

> -----Urspr√ľngliche Nachricht-----
> Von: Ivan Ivanov [mailto:rambiusparkisanius@yahoo.com] 
> Gesendet: Mittwoch, 13. April 2005 13:54
> An: Ant Users List
> Betreff: Re: AW: [Maybe spam] Re: using file names
> 
> Hello, I am not sure if this will do your job, but here is a 
> working snippet.
> <project>
> <taskdef resource="net/sf/antcontrib/antlib.xml"/>
> <for param="file">
>   <path>
>     <fileset dir="${basedir}" includes="*.xml"/>
>   </path>
>   <sequential>
>     <basename file="@{file}"
> property="@{file}.basename"/>
>     <echo>basename is ${@{file}.basename}</echo>
>   </sequential>
> </for>
> </project>
> 
> Here we bump in the following issue: ant properties are 
> immutable so if we use basename in the following way 
> <basename file="@{file}" property="basename"/> the first 
> iteration of <for> will set a property named  "basename" and 
> all other resets of this property in the next iteration will 
> have no effect. That is why we append the absolute name of 
> the file to the name of the  property to ensure uniqueness of 
> the proeprties'
> names.
> 
> However, I do not like this solution, because <for> is not 
> "the Ant way of doing things" so think twice before using it. 
> Could you provide more information what are you trying to 
> achieve with <for> and <uptodate>; a better idea might come up.
> 
> HTH Ivan
> 
> --- Huditsch Roman <Roman.Huditsch@lexisnexis.at>
> wrote:
> > Ah, I see.
> > But how can I incorporate it into an <uptodate> statement?
> > 
> > <uptodate property="copy.notRequired"
> > srcfile="@{file}">
> > 	<!-- How to specify my @targetfile correctly? --> </uptodate>
> >  
> > I would like to test @{file} againt the same basename within the 
> > "result" directory....
> > 
> > I tried it first with "result/@{file}" which gave me 
> > "result/c:\Programme\test.xml".
> > 
> > I also tried
> > <uptodate property="copy.notRequired"
> > srcfile="@{file}">
> > 	<mapper>
> > 		<flattenmapper/>
> > 		<globmapper from="*" to="result/*"/>
> > 	</mapper>
> > </uptodate>
> > but with no success either....
> > 
> > Thanks for the help!
> > 
> > wbr,
> > Roman
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!? 
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
> 
> ---------------------------------------------------------------------
> 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