ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Bassett" <bbass...@insightful.com>
Subject RE: Is there a way to search for a file matching a condition and assign it to a variable ?
Date Tue, 15 Jan 2008 19:24:53 GMT
I'd take a look at <pathconvert>, probably something like this:

<pathconvert property="my_variable">
  <fileset dir="C:\mydir" includes="commons-io-*.jar" />
</pathconvert>

Brian

-----Original Message-----
From: Hariharasudhan R [mailto:hari19@gmail.com] 
Sent: Tuesday, January 15, 2008 11:15 AM
To: Ant Users List
Subject: Is there a way to search for a file matching a condition and assign
it to a variable ?

Hi experts!

Is there a way to search for a file matching a condition and assign it to a
variable ?

Basically I want something like :

<task dir="c:\mydir" filter="commons-io-*.jar" output_variable="my_variable"
/>

my_variable should contain the list of jar files in C:\mydir that match the
pattern "commons-io-*.jar".

In my project, since C:\mydir will contain only one file matching
commons-io-*.jar my_variable will effectively contain only one file name.

My actual requirement :
copy the commons io jar ( now  commons-io-1.3.2.jar ) to commons-io.jar.
The jar may get updated over time with the newer version of commons io, but
i should not need to have to change the ant build.xml.
I thought I could get this done if I managed to capture the name of the
commons-io-*.jar in a variable and passed it as a parameter to <copy> task.

Is there a way to accomplish this ?
Any pointers is greatly appreciated.

thanks in advance,
Hari

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


Mime
View raw message