Not that I am aware of.
AFAIK there is no <count><fileset/></count>. Ant 1.7 will include "Resources" [1] (e.g. <fileset> will be one) and then there will be a <resourcecount> task. ATM I get the idea of a counting selector ... When processing a fileset the underlying DirectoryScanner asks all nested selectors (like <modified/>) if they would select that file. So the selector is asked for each file. A new selector could simply increase a number (stored in a property file). You could write that selector via <scriptselector> [2] - oh, <scriptselector> is introduced with 1.7, so you have to write that in Java. But that would only count the number of selected files - <copy> does a filecheck for its own (like many other tasks). And you dont get that info. Well, when using <copy overwrite="true"/> you switch off exactly that filecheck, and maybe with <uptodate> you could get some of the idea behind overwrite="false". Maybe could extend <copy> by extending oata.taskdefs.Copy [3] and overriding one method (it logs exactly that info to STDOUT): protected void doFileOperations() { writeToPropFile( fileCopyMap.size() ); super.doFileOperations(); } protected void writeToPropFile(int numberOfCopiedFiles) { // write to propfile } Mmmh ... seeing that .... maybe a <record> around the <copy> would do that ... I´ll do a little test ... Yep - and tested with Ant 1.6.3 and 1.7 :-) <!-- How to get the number of copied files into a property? http://marc.theaimsgroup.com/?l=ant-user&m=112275530712936&w=2 --> <project> <!-- prepare the target directory --> <mkdir dir="to"/> <!-- start logging to file --> <record name="nr.properties" action="start"/> <!-- Let 'copy' do its job --> <copy todir="to"> <fileset dir="from"/> </copy> <!-- stop writing to log file --> <record name="nr.properties" action="stop"/> <!-- convert the log message to a property-file --> <replaceregexp file="nr.properties" match=".*Copying (.*) file.*" replace="nr=\1"/> <!-- read that file, handle zero-files-copied special case (empty file created) --> <property file="nr.properties"/> <property name="nr" value="0"/> <!-- use that property --> <echo message="Copied files: ${nr}"/> </project> cheers Jan [1] http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/docs/manual/CoreTypes/resources.html?content-type=text%2Fplain [2] http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/docs/manual/CoreTypes/selectors.html?content-type=text%2Fplain#scriptselector [3] http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/src/main/org/apache/tools/ant/taskdefs/Copy.java?content-type=text%2Fplain >-----Ursprüngliche Nachricht----- >Von: KrustyDerClown [mailto:[EMAIL PROTECTED] >Gesendet: Samstag, 30. Juli 2005 22:29 >An: user@ant.apache.org >Betreff: Count copied files > >Hello, > >i have the following copy task: > ><target name="copy"> > <copy todir="${dest.dir}" overwrite="true"> > <fileset dir="${outputDir}"> > <include name="log_*.xml"/> > </fileset> > </copy> ></target> > >Can i count the files which are copied and write this number >to a property ? > >Thank you for answers. > >Greets Oliver > > > >--------------------------------------------------------------------- >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]