Ant Task for Deleting directories:
Below is an ant task that deletes the directory specified to 'dir' attribute of delete tag.
- <target name="delete-dir" >
- <delete dir="build}"/>
- <echo> /* Deleted existing directory */ </echo>
- </target>
The delete task deletes 'build' directory including all the files and subdirectories of 'build'.
The echo task just prints the message in console.
- <target name="delete-dir" >
- <delete>
- <fileset dir="." includes="**/*.java"/>
- </delete>
- </target>
Here the delete task deletes all files with the extension '.java' from the current directory(represented by '.') and any subdirectories of it.
- <target name="delete-dir" >
- <delete includeEmptyDirs="true">
- <fileset dir="build"/>
- </delete>
- </target>
- <target name="delete-dir" >
- <delete includeEmptyDirs="true">
- <fileset dir="build" includes="**/*"/>
- </delete>
- </target>
Ant Task for Making Directory:
Below is an ant task for making required directories specified to 'dir' attribute of 'mkdir' task.
- <target name="create-dir" >
- <mkdir dir="build"/>
- <echo> /* Created Directory */ </echo>
- </target>
The mkdir task creates a directory 'build' in to the root directory.
Note: mkdir creates the directory if not exists only, if exists it does nothing.
No comments:
Post a Comment