ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rohit P" <>
Subject Under a parent directory delete only 4 out of 6 child directories [non-empty]
Date Mon, 03 Nov 2008 11:45:09 GMT
I have a directory "Parent" containing 6 "child" directories with files.I
have a task of deleting only 4 "child" directories with their files.
I tried 2 approaches in getting this done. But couldn't accomplish.

Approach 1:

<project name="Check Deletion task" basedir="." default="main">

    <target name="main">
            <fileset dir="C:\Rootdir\Maindir\Parent" excludes="**\child 1\*,
**\child 2\*, **\child5\*, **\child6\*"/>

Result: This action deleted only the files under the child directories

Approach 2:

<project name="Check Deletion task" basedir="." default="main">

    <target name="main">
            <fileset dir="C:\Rootdir\Maindir\Parent\child 1"/>
            <fileset dir="C:\Rootdir\Maindir\Parent\child 2"/>
            <fileset dir="C:\Rootdir\Maindir\Parent\child5"/>
            <fileset dir="C:\Rootdir\Maindir\Parent\child6"/>

Result: Same as approach 1 deleted all the files under respective child

Can anybody suggest me how to delete only 4 child directories and their

Thanks A Ton

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