ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Villiers" <>
Subject Getting ":" delimeted, "flattened" list of files in a property?
Date Thu, 18 Apr 2002 17:15:01 GMT
Sorry for this basic question but I would like to get a list of files
from a given directory (no path info) into a property.  The files should
be delimted by a ":".  
For example, I have a directory c:\dir1\dir2\dir3 that contains files
a.txt and b.txt and I want to have a property that has the value
"a.txt:b.txt" so that I can pass it as an argument in an <exec> tag.  So
far I have the following, which still needs the "dir2/dir3/" stripped
from it:
<!-- basedir has the value c:\dir1-->
<property name="dist.server.dir" value="dir2/dir3" />
<path id="test.fileset">
   <fileset dir="${basedir}\${dist.server.dir}">
      <include name="*.txt" />
 <target name="test">
  <property name="mapfrom" value="${basedir}"/>
  <pathconvert pathsep=":" refid="test.fileset"
   <map from="${mapfrom}" to="" />
  <echo>test.filelist: ${test.filelist}</echo>

Alternatively, is there any way to do a string replacement on a property
and create a new one.  I had seen some posts on a PROPERTYCOPY function
but there is no doc for that that I have found.  I'm using ant 1.4.1.
Thanks in advance,
Peter Villiers

View raw message