org.apache.tools.ant.taskdefs
Class Delete

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.MatchingTask
              |
              +--org.apache.tools.ant.taskdefs.Delete

public class Delete
extends MatchingTask

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 intend only to provide backwards compatibility for a release. The future position is to use nested filesets exclusively.

Author:
Stefano Mazzocchi stefano@apache.org, Tom Dimock tad1@cornell.edu, Glenn McAllister glennm@ca.ibm.com, Jon S. Stevens jon@latchkey.com

Field Summary
protected  java.io.File dir
           
protected  java.io.File file
           
protected  java.util.Vector filesets
           
protected  boolean includeEmpty
           
protected  boolean usedMatchingTask
           
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset, useDefaultExcludes
 
Fields inherited from class org.apache.tools.ant.Task
description, location, project, target, taskName, taskType, wrapper
 
Constructor Summary
Delete()
           
 
Method Summary
 void addFileset(FileSet set)
          Adds a set of files (nested fileset attribute).
 PatternSet.NameEntry createExclude()
          add a name entry on the exclude list
 PatternSet.NameEntry createInclude()
          add a name entry on the include list
 PatternSet createPatternSet()
          add a set of patterns
 void execute()
          Delete the file(s).
protected  void removeDir(java.io.File d)
           
protected  void removeFiles(java.io.File d, java.lang.String[] files, java.lang.String[] dirs)
           
 void setDefaultexcludes(boolean useDefaultExcludes)
          Sets whether default exclusions should be used or not.
 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 setFile(java.io.File file)
          Set the name of a single file to be removed.
 void setIncludeEmptyDirs(boolean includeEmpty)
          Used to 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 setQuiet(boolean quiet)
          If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
 void setVerbose(boolean verbose)
          Used to force listing of all names of deleted files.
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
getDirectoryScanner, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected java.io.File file

dir

protected java.io.File dir

filesets

protected java.util.Vector filesets

usedMatchingTask

protected boolean usedMatchingTask

includeEmpty

protected boolean includeEmpty
Constructor Detail

Delete

public Delete()
Method Detail

setFile

public void setFile(java.io.File file)
Set the name of a single file to be removed.
Parameters:
file - the file to be deleted

setDir

public void setDir(java.io.File dir)
Set the directory from which files are to be deleted
Parameters:
dir - the directory path.

setVerbose

public void setVerbose(boolean verbose)
Used to force listing of all names of deleted files.
Parameters:
verbose - "true" or "on"

setQuiet

public void setQuiet(boolean quiet)
If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. This means that if a file or directory cannot be deleted, then no error is reported. This setting emulates the -f option to the Unix "rm" command. Default is false meaning things are "noisy"
Parameters:
quiet - "true" or "on"

setIncludeEmptyDirs

public void setIncludeEmptyDirs(boolean includeEmpty)
Used to delete empty directories.

addFileset

public void addFileset(FileSet set)
Adds a set of files (nested fileset attribute).

createInclude

public PatternSet.NameEntry createInclude()
add a name entry on the include list
Overrides:
createInclude in class MatchingTask

createExclude

public PatternSet.NameEntry createExclude()
add a name entry on the exclude list
Overrides:
createExclude in class MatchingTask

createPatternSet

public PatternSet createPatternSet()
add a set of patterns
Overrides:
createPatternSet in class MatchingTask

setIncludes

public void setIncludes(java.lang.String includes)
Sets the set of include patterns. Patterns may be separated by a comma or a space.
Overrides:
setIncludes in class MatchingTask
Parameters:
includes - the string containing the include patterns

setExcludes

public void setExcludes(java.lang.String excludes)
Sets the set of exclude patterns. Patterns may be separated by a comma or a space.
Overrides:
setExcludes in class MatchingTask
Parameters:
excludes - the string containing the exclude patterns

setDefaultexcludes

public void setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.
Overrides:
setDefaultexcludes in class MatchingTask
Parameters:
useDefaultExcludes - "true"|"on"|"yes" when default exclusions should be used, "false"|"off"|"no" when they shouldn't be used.

setIncludesfile

public void setIncludesfile(java.io.File includesfile)
Sets the name of the file containing the includes patterns.
Overrides:
setIncludesfile in class MatchingTask
Parameters:
includesfile - A string containing the filename to fetch the include patterns from.

setExcludesfile

public void setExcludesfile(java.io.File excludesfile)
Sets the name of the file containing the includes patterns.
Overrides:
setExcludesfile in class MatchingTask
Parameters:
excludesfile - A string containing the filename to fetch the include patterns from.

execute

public void execute()
             throws BuildException
Delete the file(s).
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

removeDir

protected void removeDir(java.io.File d)

removeFiles

protected void removeFiles(java.io.File d,
                           java.lang.String[] files,
                           java.lang.String[] dirs)


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.