|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
org.apache.tools.ant.taskdefs.Delete
public class Delete
Deletes a file or directory, or set of files defined by a fileset. The original delete task would delete a file, or a set of files using the include/exclude syntax. The deltree task would delete a directory tree. This task combines the functionality of these two originally distinct tasks.
Currently Delete extends MatchingTask. This is intended only to provide backwards compatibility for a release. The future position is to use nested filesets exclusively.
| Field Summary | |
|---|---|
protected java.io.File |
dir
|
protected java.io.File |
file
|
protected java.util.Vector<FileSet> |
filesets
|
protected boolean |
includeEmpty
|
protected boolean |
usedMatchingTask
|
| Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
|---|
fileset |
| Fields inherited from class org.apache.tools.ant.Task |
|---|
target, taskName, taskType, wrapper |
| Fields inherited from class org.apache.tools.ant.ProjectComponent |
|---|
description, location, project |
| Constructor Summary | |
|---|---|
Delete()
|
|
| Method Summary | |
|---|---|
void |
add(FileSelector selector)
add an arbitrary selector |
void |
add(ResourceCollection rc)
Add an arbitrary ResourceCollection to be deleted. |
void |
addAnd(AndSelector selector)
add an "And" selector entry on the selector list |
void |
addContains(ContainsSelector selector)
add a contains selector entry on the selector list |
void |
addContainsRegexp(ContainsRegexpSelector selector)
add a regular expression selector entry on the selector list |
void |
addCustom(ExtendSelector selector)
add an extended selector entry on the selector list |
void |
addDate(DateSelector selector)
add a selector date entry on the selector list |
void |
addDepend(DependSelector selector)
add a depends selector entry on the selector list |
void |
addDepth(DepthSelector selector)
add a depth selector entry on the selector list |
void |
addFilename(FilenameSelector selector)
add a selector filename entry on the selector list |
void |
addFileset(FileSet set)
Adds a set of files to be deleted. |
void |
addMajority(MajoritySelector selector)
add a majority selector entry on the selector list |
void |
addModified(ModifiedSelector selector)
add the modified selector |
void |
addNone(NoneSelector selector)
add a "None" selector entry on the selector list |
void |
addNot(NotSelector selector)
add a "Not" selector entry on the selector list |
void |
addOr(OrSelector selector)
add an "Or" selector entry on the selector list |
void |
addPresent(PresentSelector selector)
add a present selector entry on the selector list |
void |
addSelector(SelectSelector selector)
add a "Select" selector entry on the selector list |
void |
addSize(SizeSelector selector)
add a selector size entry on the selector list |
PatternSet.NameEntry |
createExclude()
add a name entry on the exclude list |
PatternSet.NameEntry |
createExcludesFile()
add a name entry on the include files list |
PatternSet.NameEntry |
createInclude()
add a name entry on the include list |
PatternSet.NameEntry |
createIncludesFile()
add a name entry on the include files list |
PatternSet |
createPatternSet()
add a set of patterns |
void |
execute()
Delete the file(s). |
protected void |
removeDir(java.io.File d)
Delete a directory |
protected void |
removeFiles(java.io.File d,
java.lang.String[] files,
java.lang.String[] dirs)
remove an array of files in a directory, and a list of subdirectories which will only be deleted if 'includeEmpty' is true |
void |
setCaseSensitive(boolean isCaseSensitive)
Sets case sensitivity of the file system |
void |
setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not. |
void |
setDeleteOnExit(boolean deleteOnExit)
If true, on failure to delete, note the error and set the deleteonexit flag, and continue |
void |
setDir(java.io.File dir)
Set the directory from which files are to be deleted |
void |
setExcludes(java.lang.String excludes)
Sets the set of exclude patterns. |
void |
setExcludesfile(java.io.File excludesfile)
Sets the name of the file containing the includes patterns. |
void |
setFailOnError(boolean failonerror)
If false, note errors but continue. |
void |
setFile(java.io.File file)
Set the name of a single file to be removed. |
void |
setFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed. |
void |
setIncludeEmptyDirs(boolean includeEmpty)
If true, delete empty directories. |
void |
setIncludes(java.lang.String includes)
Sets the set of include patterns. |
void |
setIncludesfile(java.io.File includesfile)
Sets the name of the file containing the includes patterns. |
void |
setPerformGcOnFailedDelete(boolean b)
Whether to perform a garbage collection before retrying a failed delete. |
void |
setQuiet(boolean quiet)
If true and the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. |
void |
setRemoveNotFollowedSymlinks(boolean b)
Sets whether the symbolic links that have not been followed shall be removed (the links, not the locations they point at). |
void |
setVerbose(boolean verbose)
If true, list all names of deleted files. |
| Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
|---|
addDifferent, addType, appendSelector, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setProject, XsetIgnore, XsetItems |
| Methods inherited from class org.apache.tools.ant.Task |
|---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
| Methods inherited from class org.apache.tools.ant.ProjectComponent |
|---|
clone, getDescription, getLocation, getProject, setDescription, setLocation |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.io.File file
protected java.io.File dir
protected java.util.Vector<FileSet> filesets
protected boolean usedMatchingTask
protected boolean includeEmpty
| Constructor Detail |
|---|
public Delete()
| Method Detail |
|---|
public void setFile(java.io.File file)
file - the file to be deletedpublic void setDir(java.io.File dir)
dir - the directory path.public void setVerbose(boolean verbose)
verbose - "true" or "on"public void setQuiet(boolean quiet)
quiet - "true" or "on"public void setFailOnError(boolean failonerror)
failonerror - true or falsepublic void setDeleteOnExit(boolean deleteOnExit)
deleteOnExit - true or falsepublic void setIncludeEmptyDirs(boolean includeEmpty)
includeEmpty - if true delete empty directories (only
for filesets). Default is false.public void setPerformGcOnFailedDelete(boolean b)
This may be required on Windows (where it is set to true by default) but also on other operating systems, for example when deleting directories from an NFS share.
public void addFileset(FileSet set)
set - the set of files to be deletedpublic void add(ResourceCollection rc)
rc - the filesystem-only ResourceCollection.public PatternSet.NameEntry createInclude()
createInclude in class MatchingTaskpublic PatternSet.NameEntry createIncludesFile()
createIncludesFile in class MatchingTaskpublic PatternSet.NameEntry createExclude()
createExclude in class MatchingTaskpublic PatternSet.NameEntry createExcludesFile()
createExcludesFile in class MatchingTaskpublic PatternSet createPatternSet()
createPatternSet in class MatchingTaskpublic void setIncludes(java.lang.String includes)
setIncludes in class MatchingTaskincludes - the string containing the include patternspublic void setExcludes(java.lang.String excludes)
setExcludes in class MatchingTaskexcludes - the string containing the exclude patternspublic void setDefaultexcludes(boolean useDefaultExcludes)
setDefaultexcludes in class MatchingTaskuseDefaultExcludes - "true"|"on"|"yes" when default exclusions
should be used, "false"|"off"|"no" when they
shouldn't be used.public void setIncludesfile(java.io.File includesfile)
setIncludesfile in class MatchingTaskincludesfile - A string containing the filename to fetch
the include patterns from.public void setExcludesfile(java.io.File excludesfile)
setExcludesfile in class MatchingTaskexcludesfile - A string containing the filename to fetch
the include patterns from.public void setCaseSensitive(boolean isCaseSensitive)
setCaseSensitive in class MatchingTaskisCaseSensitive - "true"|"on"|"yes" if file system is case
sensitive, "false"|"off"|"no" when not.public void setFollowSymlinks(boolean followSymlinks)
setFollowSymlinks in class MatchingTaskfollowSymlinks - whether or not symbolic links should be followedpublic void setRemoveNotFollowedSymlinks(boolean b)
public void addSelector(SelectSelector selector)
addSelector in interface SelectorContaineraddSelector in class MatchingTaskselector - the selector to be addedpublic void addAnd(AndSelector selector)
addAnd in interface SelectorContaineraddAnd in class MatchingTaskselector - the selector to be addedpublic void addOr(OrSelector selector)
addOr in interface SelectorContaineraddOr in class MatchingTaskselector - the selector to be addedpublic void addNot(NotSelector selector)
addNot in interface SelectorContaineraddNot in class MatchingTaskselector - the selector to be addedpublic void addNone(NoneSelector selector)
addNone in interface SelectorContaineraddNone in class MatchingTaskselector - the selector to be addedpublic void addMajority(MajoritySelector selector)
addMajority in interface SelectorContaineraddMajority in class MatchingTaskselector - the selector to be addedpublic void addDate(DateSelector selector)
addDate in interface SelectorContaineraddDate in class MatchingTaskselector - the selector to be addedpublic void addSize(SizeSelector selector)
addSize in interface SelectorContaineraddSize in class MatchingTaskselector - the selector to be addedpublic void addFilename(FilenameSelector selector)
addFilename in interface SelectorContaineraddFilename in class MatchingTaskselector - the selector to be addedpublic void addCustom(ExtendSelector selector)
addCustom in interface SelectorContaineraddCustom in class MatchingTaskselector - the selector to be addedpublic void addContains(ContainsSelector selector)
addContains in interface SelectorContaineraddContains in class MatchingTaskselector - the selector to be addedpublic void addPresent(PresentSelector selector)
addPresent in interface SelectorContaineraddPresent in class MatchingTaskselector - the selector to be addedpublic void addDepth(DepthSelector selector)
addDepth in interface SelectorContaineraddDepth in class MatchingTaskselector - the selector to be addedpublic void addDepend(DependSelector selector)
addDepend in interface SelectorContaineraddDepend in class MatchingTaskselector - the selector to be addedpublic void addContainsRegexp(ContainsRegexpSelector selector)
addContainsRegexp in interface SelectorContaineraddContainsRegexp in class MatchingTaskselector - the selector to be addedpublic void addModified(ModifiedSelector selector)
addModified in interface SelectorContaineraddModified in class MatchingTaskselector - the selector to addpublic void add(FileSelector selector)
add in interface SelectorContaineradd in class MatchingTaskselector - the selector to be added
public void execute()
throws BuildException
execute in class TaskBuildException - if an error occursprotected void removeDir(java.io.File d)
d - the directory to delete
protected void removeFiles(java.io.File d,
java.lang.String[] files,
java.lang.String[] dirs)
d - directory to work fromfiles - array of files to delete; can be of zero lengthdirs - array of directories to delete; can of zero length
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||