You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ndario <da...@yahoo.com> on 2008/11/26 15:53:49 UTC
how to use ?
Hello,
I want to copy a set of files to a directory which is dynamically generated.
I know only a part of name of that directory, it looks like this "tmp*abc":
tmp24235abc
tmp76957abc
tmp556abc
tmp6344abc
I need to copy files to a directory which has latest creation date. I guess
it would be possible with <sort> and <first> elements but I have no idea how
to use it? This example
<copy todir="dest" flatten="true">
<first count="2">
<sort>
<date
xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/>
<resources>
<file file="src_dir/file1.txt"/>
<file file="src_dir/file2.txt"/>
<file file="src_dir/file3.txt"/>
<url url="http://ant.apache.org/index.html"/>
</resources>
</sort>
</first>
</copy>
finds latest file and copies it to the destination, but I want the oposite.
I need to determine correct destination.
Could anybody give me a hint how to use <first>, please.
Thanks
--
View this message in context: http://www.nabble.com/how-to-use-%3Cfirst%3E--tp20702429p20702429.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: how to use ?
Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
-----Original Message-----
From: ndario [mailto:darionis@yahoo.com]
Sent: Wednesday, November 26, 2008 3:54 PM
To: user@ant.apache.org
Subject: how to use <first>?
/*
Hello,
I want to copy a set of files to a directory which is dynamically generated.
I know only a part of name of that directory, it looks like this "tmp*abc":
tmp24235abc
tmp76957abc
tmp556abc
tmp6344abc
I need to copy files to a directory which has latest creation date. I guess
it would be possible with <sort> and <first> elements but I have no idea how
to use it? This example
*/
if you're able to use antcontrib, you use the timestampselector like that =
<timestampselector property="most.recent.dir" count="1">
<path>
<dirset dir="Y:/">
<include name="tmp*" />
</dirset>
</path>
</timestampselector>
<echo>$${most.recent.dir} = ${most.recent.dir}</echo>
and the most.recent.dir property has the directory
you're are searching for.
Don't know if there's an alternative with ant 1.7.1, as i still
use ant 1.6.5 and still had no time to explore the new features.
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: how to use ?
Posted by ndario <da...@yahoo.com>.
I finally made it!!!
It took lot of tries and errors, someone may find this usefull:
<pathconvert property="lastDir">
<first>
<sort>
<dirset id="deployPattern" dir="${temp.dir}">
<include name="tmp*abc" />
</dirset>
<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
<date />
</reverse>
</sort>
</first>
</pathconvert>
<!--
<echo message="${lastDir}" />
-->
<copy todir="${lastDir}"
verbose="true"
includeEmptyDirs="false">
<fileset dir="${src.dir}" includes="**/*.txt" />
</copy>
--
View this message in context: http://www.nabble.com/how-to-use-%3Cfirst%3E--tp20702429p20717561.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: ****SPAM**** how to use ?
Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
Who creates this dir?
Who knows the name?
The best way is to pass the information on to your antfile.
--
Jürgen Knuplesch
-----Ursprüngliche Nachricht-----
Von: ndario [mailto:darionis@yahoo.com]
Gesendet: Mittwoch, 26. November 2008 15:54
An: user@ant.apache.org
Betreff: ****SPAM**** how to use <first>?
Hello,
I want to copy a set of files to a directory which is dynamically generated.
I know only a part of name of that directory, it looks like this "tmp*abc":
tmp24235abc
tmp76957abc
tmp556abc
tmp6344abc
I need to copy files to a directory which has latest creation date. I guess it would be possible with <sort> and <first> elements but I have no idea how to use it? This example
<copy todir="dest" flatten="true">
<first count="2">
<sort>
<date
xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/>
<resources>
<file file="src_dir/file1.txt"/>
<file file="src_dir/file2.txt"/>
<file file="src_dir/file3.txt"/>
<url url="http://ant.apache.org/index.html"/>
</resources>
</sort>
</first>
</copy>
finds latest file and copies it to the destination, but I want the oposite.
I need to determine correct destination.
Could anybody give me a hint how to use <first>, please.
Thanks
--
View this message in context: http://www.nabble.com/how-to-use-%3Cfirst%3E--tp20702429p20702429.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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