ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ninju Bohra <>
Subject Changing the "leading directory" path on a directory tree
Date Tue, 14 Mar 2006 21:59:42 GMT
Hello all,
I am not sure if I can explain this correctly, so I will show you the target text and then
explain the problem
   <target name="publish.documents" depends="init, fetch.files, get.change.list">
      <property name="changes.dir" value="C:\dir_viewer\Since_Last_changes"/>
      <property name="output.root.dir" value="C:\dir_viewer\Documentation"/>
      <for param="file">
          <fileset dir="${changes.dir}" excludes="${dont.convert}"/>
          <!-- construct the destination full filename and path, need to 
               change the extension to .pdf and the replace the "leading directory" path
               from ${changes.dir} to ${output.root.dir} -->
          <propertyregex override="yes"
            property="destfile"  input="@{file}"
            regexp=".*/([^\.]*)\.cpp" replace="\1"/>
          <!-- invoke the pdf convertor passing the two files paths -->
          <exec executable="C:\Program Files\e-PDF Document Converter v2.1\doc2pdf.exe">
             <arg value="-i"/>
             <arg value="@{file}"/>
             <arg value="-o"/>
             <arg value="${destfile}"/>
          <!-- after converting the file we can delete the source file -->
          <delete file="${file}"/>
      <!-- Now copy over all the remaining files from changes.dir -->
       <copy todir="${output.root.dir}">
          <fileset dir="${changes.dir}"/>

 I copied most of the <for> task text from the example provided in the ant-contrib documentation
and made my modifications.
The problem I am having is in the <propertyregex> task (the first task afterthe <sequential>),
what I want to do is convert filepaths that are provided in the @{file} attribute from
  C:\dir_viewer\Since_Last_changes\abc\yada yada\yada\Bob.doc
  ${output.root.dir}\abc\yada yada\yada\Bob.pdf
I know the code above will not accomplish all that (the <propertyregex> is incorrect)
but I did not know if it was even possible to do that with property manipulations anyways.
Any ideas,
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message