ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Copy directories
Date Mon, 25 Aug 2003 08:20:11 GMT
I had never used them, but it sounds like a job for <mapper>.

A quick test on windows gave me that:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="test" basedir="." default="main">

    <target name="clean">
        <delete dir="to" failonerror="false"/>
    </target>

    <target name="init">
        <mkdir dir="from/test1/sample/testA/tp/com/company/project"/>
        <touch
file="from/test1/sample/testA/tp/com/company/project/Main.java"/>
        <mkdir dir="from/test2/sample/testb/tp/com/company/project2"/>
        <touch
file="from/test2/sample/testb/tp/com/company/project2/Main.java"/>
        <mkdir dir="from/test3/sample/testC/tp/com/company/project3"/>
        <touch
file="from/test3/sample/testC/tp/com/company/project3/Main.java"/>
        <mkdir dir="from/test4/sample/testD/tp/com/company/project4"/>
        <touch
file="from/test4/sample/testD/tp/com/company/project4/Main.java"/>
    </target>

    <target name="main" depends="clean,init">
        <copy todir="to">
            <fileset dir="from"/>
            <mapper type="regexp" from="(.*)\\tp\\(.*)" to="\2"/>
        </copy>
        <fileset id="to.fs" dir="to"/>
        <pathconvert refid="to.fs" pathsep="${line.separator}"
property="to.value"/>
        <echo message="${to.value}"/>
        <!--
        <mkdir dir="to"/>
        <exec outputproperty="listing" executable="cmd.exe" dir="to"><arg
line="/C tree /A /F"/></exec>
        <echo message="${listing}"/>
        -->
    </target>
</project>



But the "from"-value of the mapper is platform dependent :-(, I tried the
'/', but it didnĀ“t work.


Jan

> -----Original Message-----
> From: shiva_vel [mailto:shiva_vel@yahoo.com]
> Sent: Saturday, August 23, 2003 12:28 PM
> To: ant-user@jakarta.apache.org
> Subject: Copy directories
> 
> 
> Hello,
> 
> I have a list of directories as follows
> 
> <home>/test1/sample/testA/tp/com/../../../ 
> <home>/test2/sample/testb/tp/com/../../../
> <home>/test3/sample/testC/tp/com/../../../
> <home>/test4/sample/testD/tp/com/../../../
> 
> I want to copy all the "com" directories and its contents
> (com/../../../) from the list of directories .I dont want the entire
> path to get copied.It should start only from com.
> 
> How can i do this.
> 
> Thanx in advance,
> 
> regards
> 
> Sivaraja.K
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message