ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: problem: how to copy multiple directories in ant
Date Tue, 20 Jan 2009 08:06:46 GMT

-----Original Message-----
From: []
Sent: Monday, January 19, 2009 6:55 PM
Subject: problem: how to copy multiple directories in ant


I have a well-defined problem I can easily solve via a shell script, but
want to know the ant-equivalent. This issue has come up on the ant user
mailing list before, but no answer surfaced. I've tried using various
combinations of fileset and dirset, but without success. Can someone
offer some insights?

The problem:
I have a directory structure like this:


I want to copy all the '.class' files in the ' patches/*/com'
directories to an output directory "staging_classes", i.e. so I end up
with the directory structure:
  |--------------Bad.class (from patch02)
  |--------------Good.class (from patch01)
  |--------------Ugly.class (from patch02)



<project name="bla" default="main" basedir=".">

<!-- // Taskdefs -->
<!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<!-- Taskdefs // -->

<!-- // Properties -->
<property name="patchroot" value="C:/patches"/>
<property name="stagedir" value="C:/stagedir"/>
<!-- Properties // -->

<target name="main">
  <for param="patchdir">
    <dirset dir="${patchroot}" includes="**/patch*/**" />
      <echo>Patchdir = @{patchdir}</echo>
      <copy todir="${stagedir}" overwrite="true" verbose="true">
        <fileset dir="@{patchdir}" includes="*/*.class" />


Regards, Gilbert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message