- Ant Tasks - Discussion
- Ant Tasks - Useful Resources
- Ant Tasks - Quick Guide
- ANT Tasks -JAR
- ANT Tasks - Zip
- ANT Tasks - WAR
- ANT Tasks - Sleep
- ANT Tasks - Move
- ANT Tasks - MkDir
- ANT Tasks - LoadFile
- ANT Tasks - Length
- ANT Tasks - Javac
- ANT Tasks - Java
- ANT Tasks - Import
- ANT Tasks - Fail
- ANT Tasks - EAR
- ANT Tasks - Delete
- ANT Tasks - Copy
- ANT Tasks - Condition
- ANT Tasks - Concat
- ANT Tasks - Chmod
- ANT Tasks - GUnzip
- ANT Tasks - GZip
- ANT Tasks - BaseName
- ANT Tasks - Environment Setup
- ANT Tasks - Introduction
- ANT Tasks - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Apache Ant Tasks - Delete
Description
Delete task deletes a single file, a specified directory and all its files and subdirectories, or a set of files specified by one or more resource collections.
Properties
Sr.No | Attributes & Description |
---|---|
1 | File The file to delete, specified as either the simple filename (if the file exists in the current base directory), a relative-path filename, or a full-path filename. |
2 | DIR The directory to delete, including all its files and subdirectories. |
3 | Verbose Whether to show the name of each deleted file. |
4 | Quiet If the specified file or directory does not exist, do not display a diagnostic message. |
5 | Failonerror Controls whether an error (such as a failure to delete a file) stops the build or is merely reported to the screen. Only relevant if quiet is false. |
6 | Includeemptydirs Whether to delete empty directories when using filesets. |
7 | Deleteonexit Indicates whether to use File#deleteOnExit() if there is a failure to delete a file. This causes the JVM to attempt to delete the file when the JVM process is terminating. |
8 | removeNotFollowedSympnks Whether symbopc pnks (not the files/directories they pnk to) should be removed if they haven t been followed because followSympnks was false or the maximum number of symbopc pnks was too big. |
9 | performGCOnFailedDelete If Ant fails to delete a file or directory it will retry the operation once. If this flag is set to true it will perform a garbage collection before retrying the delete. |
Example
Usage
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <target name="info"> <delete file="text.txt" verbose="true"></delete> </target> </project>
Output
Running Ant on the above build file produces the following output −
F: utorialspointant>ant Buildfile: F: utorialspointantuild.xml info: [delete] Deleting: F: utorialspointant ext.txt BUILD SUCCESSFUL Total time: 0 secondsAdvertisements