Ant: simplest way to copy over a relative list of files

Posted by Derek Illchuk on Stack Overflow See other posts from Stack Overflow or by Derek Illchuk
Published on 2010-06-11T15:11:42Z Indexed on 2010/06/11 15:22 UTC
Read the original article Hit count: 176

Filed under:
|

Using Ant, I want to copy a list of files from one project to another, where each project has the same directory structure. Is there a way to get the following to work?

<project name="WordSlug" default="pull" basedir=".">

  <description>
      WordSlug: pull needed files
  </description>

  <property name="prontiso_home" location="../../prontiso/trunk"/>

  <!-- I know this doesn't work, what's the missing piece? -->
  <target name="pull" description="Pull needed files">
      <copy todir="." overwrite="true">
        <resources>
          <file file="${prontiso_home}/application/views/scripts/error/error.phtml"/>
          <file file="${prontiso_home}/application/controllers/CacheController.php"/>
          <!-- etc. -->
        </resources>
      </copy>
  </target>

</project>

Success is deriving the paths automatically:

${prontiso_home}/application/views/scripts/error/error.phtml copied to ./application/views/scripts/error/error.phtml
${prontiso_home}/application/controllers/CacheController.php copied to ./application/controllers/CacheController.php

Thanks!

© Stack Overflow or respective owner

Related posts about ant

Related posts about copy