public class Delete extends MatchingTask
Currently Delete extends MatchingTask. This is intended only to provide backwards compatibility for a release. The future position is to use nested filesets exclusively.
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
dir |
protected java.io.File |
file |
protected java.util.Vector<FileSet> |
filesets |
protected boolean |
includeEmpty |
protected boolean |
usedMatchingTask |
fileset
description, location, project
Constructor and Description |
---|
Delete() |
Modifier and Type | Method and Description |
---|---|
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.
|
addDifferent, addType, appendSelector, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setProject, XsetIgnore, XsetItems
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation
protected java.io.File file
protected java.io.File dir
protected java.util.Vector<FileSet> filesets
protected boolean usedMatchingTask
protected boolean includeEmpty
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.
b
- booleanpublic 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 MatchingTask
public PatternSet.NameEntry createIncludesFile()
createIncludesFile
in class MatchingTask
public PatternSet.NameEntry createExclude()
createExclude
in class MatchingTask
public PatternSet.NameEntry createExcludesFile()
createExcludesFile
in class MatchingTask
public PatternSet createPatternSet()
createPatternSet
in class MatchingTask
public void setIncludes(java.lang.String includes)
setIncludes
in class MatchingTask
includes
- the string containing the include patternspublic void setExcludes(java.lang.String excludes)
setExcludes
in class MatchingTask
excludes
- the string containing the exclude patternspublic void setDefaultexcludes(boolean useDefaultExcludes)
setDefaultexcludes
in class MatchingTask
useDefaultExcludes
- "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 MatchingTask
includesfile
- A string containing the filename to fetch
the include patterns from.public void setExcludesfile(java.io.File excludesfile)
setExcludesfile
in class MatchingTask
excludesfile
- A string containing the filename to fetch
the include patterns from.public void setCaseSensitive(boolean isCaseSensitive)
setCaseSensitive
in class MatchingTask
isCaseSensitive
- "true"|"on"|"yes" if file system is case
sensitive, "false"|"off"|"no" when not.public void setFollowSymlinks(boolean followSymlinks)
setFollowSymlinks
in class MatchingTask
followSymlinks
- whether or not symbolic links should be followedpublic void setRemoveNotFollowedSymlinks(boolean b)
b
- booleanpublic void addSelector(SelectSelector selector)
addSelector
in interface SelectorContainer
addSelector
in class MatchingTask
selector
- the selector to be addedpublic void addAnd(AndSelector selector)
addAnd
in interface SelectorContainer
addAnd
in class MatchingTask
selector
- the selector to be addedpublic void addOr(OrSelector selector)
addOr
in interface SelectorContainer
addOr
in class MatchingTask
selector
- the selector to be addedpublic void addNot(NotSelector selector)
addNot
in interface SelectorContainer
addNot
in class MatchingTask
selector
- the selector to be addedpublic void addNone(NoneSelector selector)
addNone
in interface SelectorContainer
addNone
in class MatchingTask
selector
- the selector to be addedpublic void addMajority(MajoritySelector selector)
addMajority
in interface SelectorContainer
addMajority
in class MatchingTask
selector
- the selector to be addedpublic void addDate(DateSelector selector)
addDate
in interface SelectorContainer
addDate
in class MatchingTask
selector
- the selector to be addedpublic void addSize(SizeSelector selector)
addSize
in interface SelectorContainer
addSize
in class MatchingTask
selector
- the selector to be addedpublic void addFilename(FilenameSelector selector)
addFilename
in interface SelectorContainer
addFilename
in class MatchingTask
selector
- the selector to be addedpublic void addCustom(ExtendSelector selector)
addCustom
in interface SelectorContainer
addCustom
in class MatchingTask
selector
- the selector to be addedpublic void addContains(ContainsSelector selector)
addContains
in interface SelectorContainer
addContains
in class MatchingTask
selector
- the selector to be addedpublic void addPresent(PresentSelector selector)
addPresent
in interface SelectorContainer
addPresent
in class MatchingTask
selector
- the selector to be addedpublic void addDepth(DepthSelector selector)
addDepth
in interface SelectorContainer
addDepth
in class MatchingTask
selector
- the selector to be addedpublic void addDepend(DependSelector selector)
addDepend
in interface SelectorContainer
addDepend
in class MatchingTask
selector
- the selector to be addedpublic void addContainsRegexp(ContainsRegexpSelector selector)
addContainsRegexp
in interface SelectorContainer
addContainsRegexp
in class MatchingTask
selector
- the selector to be addedpublic void addModified(ModifiedSelector selector)
addModified
in interface SelectorContainer
addModified
in class MatchingTask
selector
- the selector to addpublic void add(FileSelector selector)
add
in interface SelectorContainer
add
in class MatchingTask
selector
- the selector to be addedpublic void execute() throws BuildException
execute
in class Task
BuildException
- if an error occursprotected void removeDir(java.io.File d)
d
- the directory to deleteprotected 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