ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Deleting multiple directories
Date Fri, 20 Jun 2003 08:49:21 GMT
I remembered that I wrote an example how to delete files with javascript:
http://marc.theaimsgroup.com/?l=ant-user&m=105479687100771&w=2
"Problem with deleting a file inside javascript"


And a quick wrote:

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

    <target name="init">
        <mkdir dir="dir1"/>
        <mkdir dir="dir2"/>
        <mkdir dir="dir3"/>
        <mkdir dir="dir4"/>
    </target>

    <target name="main" depends="init">
        <property name="4delete" value="dir1,dir2,dir3" />
        <script language="javascript"> <![CDATA[

            st = new java.util.StringTokenizer(
                project.getProperty("4delete"),
                ",");
            del = project.createTask("delete");
            while (st.hasMoreTokens()) {
                dir = new java.io.File(st.nextToken());
                del.setDir(dir);
                del.perform();
            }
        ]]> </script>
    </target>
</project>




init:
    [mkdir] Created dir: C:\temp\delDirs\dir1
    [mkdir] Created dir: C:\temp\delDirs\dir2
    [mkdir] Created dir: C:\temp\delDirs\dir3
    [mkdir] Created dir: C:\temp\delDirs\dir4

main:
   [delete] Deleting directory C:\temp\delDirs\dir1
   [delete] Deleting directory C:\temp\delDirs\dir2
   [delete] Deleting directory C:\temp\delDirs\dir3

BUILD SUCCESSFUL



Jan


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