-----Original Message-----
From: Sujie [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 26, 2007 10:42 AM
To: user@ant.apache.org
Subject: Ant task to Count number of files in a directory

/*
Hi

I would like to count the number of jar files in a directory. 
I am using ANT 1.7.
*/

with ant < 1.7

<script language="ruby">
<![CDATA[
$project.setProperty "yourproperty", Dir["C:/your/path/**/*.jar"].length
]]>
</script>

use your/path/**/*.jar if you want to search recursive,
otherwise use /*.jar

${yourproperty} contains number of jars


with ant => 1.7
see manual coretasks / resourcecount


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to