Title: Message
i don't see a native way in nant, but for grins, i just did this.  it's "ugly", possibly there's a better approach, and it's not stress tested, but it "works on my machine".  basically, roll your own directory recursion:
 
<target name="testCopy" >
  <property name="flatcopy.dir.dest" value="bin" />
  <property name="flatcopy.dir.src" value="." />
  <property name="flatcopy.spec" value="*.dll" />
  <call target="flatcopy" force="true" />
</target>
 
<target name="flatcopy" >
  <mkdir dir="${flatcopy.dir.dest}" />
  <property name="flatcopy.dir.src.cur" value="${flatcopy.dir.src}" />
  <call target="flatcopy.recurse" />
</target>
 
<target name="flatcopy.recurse" >
  <echo message="${flatcopy.dir.src.cur}" />
  <copy todir="${flatcopy.dir.dest}" >
    <fileset basedir="${flatcopy.dir.src.cur}" >
      <includes name="${flatcopy.spec}" />
    </fileset>
  </copy>
  <foreach item="Folder" property="dir" in="${flatcopy.dir.src.cur}" >
    <property name="flatcopy.dir.src.cur" value="${dir}" />
    <call target="flatcopy.recurse" force="true" />
  </foreach>
</target>
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raghu Murthy
Sent: Saturday, June 07, 2003 09:47
To: [EMAIL PROTECTED]
Subject: [Nant-users] Copy with the flatten feature

Hi,

 

I Apache Ant, there is a flag that allows copy to flatten the directory structure and copy only files that match. I.e. the source directory structure is ignored.

 

<copy todir=”bin” flatten=”true”>

            <fileset basedir=”.”>

                        <includes name=”**/*.dll”/>

            </fileset>

</copy>

 

Is there any way to do this with NAnt? It seems to copy the entire directory structure along with the files.

 

Thanks,

Raghu

Reply via email to